1. Packages
  2. AWS
  3. API Docs
  4. iam
  5. getUserSshKey
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.iam.getUserSshKey

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Use this data source to get information about a SSH public key associated with the specified IAM user.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.iam.getUserSshKey({
        encoding: "SSH",
        sshPublicKeyId: "APKARUZ32GUTKIGARLXE",
        username: "test-user",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.iam.get_user_ssh_key(encoding="SSH",
        ssh_public_key_id="APKARUZ32GUTKIGARLXE",
        username="test-user")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.GetUserSshKey(ctx, &iam.GetUserSshKeyArgs{
    			Encoding:       "SSH",
    			SshPublicKeyId: "APKARUZ32GUTKIGARLXE",
    			Username:       "test-user",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Iam.GetUserSshKey.Invoke(new()
        {
            Encoding = "SSH",
            SshPublicKeyId = "APKARUZ32GUTKIGARLXE",
            Username = "test-user",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetUserSshKeyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = IamFunctions.getUserSshKey(GetUserSshKeyArgs.builder()
                .encoding("SSH")
                .sshPublicKeyId("APKARUZ32GUTKIGARLXE")
                .username("test-user")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:iam:getUserSshKey
          Arguments:
            encoding: SSH
            sshPublicKeyId: APKARUZ32GUTKIGARLXE
            username: test-user
    

    Using getUserSshKey

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getUserSshKey(args: GetUserSshKeyArgs, opts?: InvokeOptions): Promise<GetUserSshKeyResult>
    function getUserSshKeyOutput(args: GetUserSshKeyOutputArgs, opts?: InvokeOptions): Output<GetUserSshKeyResult>
    def get_user_ssh_key(encoding: Optional[str] = None,
                         ssh_public_key_id: Optional[str] = None,
                         username: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetUserSshKeyResult
    def get_user_ssh_key_output(encoding: Optional[pulumi.Input[str]] = None,
                         ssh_public_key_id: Optional[pulumi.Input[str]] = None,
                         username: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetUserSshKeyResult]
    func GetUserSshKey(ctx *Context, args *GetUserSshKeyArgs, opts ...InvokeOption) (*GetUserSshKeyResult, error)
    func GetUserSshKeyOutput(ctx *Context, args *GetUserSshKeyOutputArgs, opts ...InvokeOption) GetUserSshKeyResultOutput

    > Note: This function is named GetUserSshKey in the Go SDK.

    public static class GetUserSshKey 
    {
        public static Task<GetUserSshKeyResult> InvokeAsync(GetUserSshKeyArgs args, InvokeOptions? opts = null)
        public static Output<GetUserSshKeyResult> Invoke(GetUserSshKeyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUserSshKeyResult> getUserSshKey(GetUserSshKeyArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:iam/getUserSshKey:getUserSshKey
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Encoding string
    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
    SshPublicKeyId string
    Unique identifier for the SSH public key.
    Username string
    Name of the IAM user associated with the SSH public key.
    Encoding string
    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
    SshPublicKeyId string
    Unique identifier for the SSH public key.
    Username string
    Name of the IAM user associated with the SSH public key.
    encoding String
    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
    sshPublicKeyId String
    Unique identifier for the SSH public key.
    username String
    Name of the IAM user associated with the SSH public key.
    encoding string
    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
    sshPublicKeyId string
    Unique identifier for the SSH public key.
    username string
    Name of the IAM user associated with the SSH public key.
    encoding str
    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
    ssh_public_key_id str
    Unique identifier for the SSH public key.
    username str
    Name of the IAM user associated with the SSH public key.
    encoding String
    Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
    sshPublicKeyId String
    Unique identifier for the SSH public key.
    username String
    Name of the IAM user associated with the SSH public key.

    getUserSshKey Result

    The following output properties are available:

    Encoding string
    Fingerprint string
    MD5 message digest of the SSH public key.
    Id string
    The provider-assigned unique ID for this managed resource.
    PublicKey string
    SSH public key.
    SshPublicKeyId string
    Status string
    Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
    Username string
    Encoding string
    Fingerprint string
    MD5 message digest of the SSH public key.
    Id string
    The provider-assigned unique ID for this managed resource.
    PublicKey string
    SSH public key.
    SshPublicKeyId string
    Status string
    Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
    Username string
    encoding String
    fingerprint String
    MD5 message digest of the SSH public key.
    id String
    The provider-assigned unique ID for this managed resource.
    publicKey String
    SSH public key.
    sshPublicKeyId String
    status String
    Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
    username String
    encoding string
    fingerprint string
    MD5 message digest of the SSH public key.
    id string
    The provider-assigned unique ID for this managed resource.
    publicKey string
    SSH public key.
    sshPublicKeyId string
    status string
    Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
    username string
    encoding str
    fingerprint str
    MD5 message digest of the SSH public key.
    id str
    The provider-assigned unique ID for this managed resource.
    public_key str
    SSH public key.
    ssh_public_key_id str
    status str
    Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
    username str
    encoding String
    fingerprint String
    MD5 message digest of the SSH public key.
    id String
    The provider-assigned unique ID for this managed resource.
    publicKey String
    SSH public key.
    sshPublicKeyId String
    status String
    Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
    username String

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi