1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. ec2
  5. getKeyPair

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.0.1 published on Tuesday, Oct 1, 2024 by Pulumi

aws-native.ec2.getKeyPair

Explore with Pulumi AI

aws-native logo

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.0.1 published on Tuesday, Oct 1, 2024 by Pulumi

    Specifies a key pair for use with an EC2long instance as follows:

    • To import an existing key pair, include the PublicKeyMaterial property.
    • To create a new key pair, omit the PublicKeyMaterial property.

    When you import an existing key pair, you specify the public key material for the key. We assume that you have the private key material for the key. CFNlong does not create or return the private key material when you import a key pair. When you create a new key pair, the private key is saved to SYSlong Parameter Store, using a parameter with the following name: /ec2/keypair/{key_pair_id}. For more information about retrieving private key, and the required permissions, see Create a key pair using in the User Guide. When CFN deletes a key pair that was created or imported by a stack, it also deletes the parameter that was used to store the private key material in Parameter Store.

    Using getKeyPair

    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 getKeyPair(args: GetKeyPairArgs, opts?: InvokeOptions): Promise<GetKeyPairResult>
    function getKeyPairOutput(args: GetKeyPairOutputArgs, opts?: InvokeOptions): Output<GetKeyPairResult>
    def get_key_pair(key_name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetKeyPairResult
    def get_key_pair_output(key_name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetKeyPairResult]
    func LookupKeyPair(ctx *Context, args *LookupKeyPairArgs, opts ...InvokeOption) (*LookupKeyPairResult, error)
    func LookupKeyPairOutput(ctx *Context, args *LookupKeyPairOutputArgs, opts ...InvokeOption) LookupKeyPairResultOutput

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

    public static class GetKeyPair 
    {
        public static Task<GetKeyPairResult> InvokeAsync(GetKeyPairArgs args, InvokeOptions? opts = null)
        public static Output<GetKeyPairResult> Invoke(GetKeyPairInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKeyPairResult> getKeyPair(GetKeyPairArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws-native:ec2:getKeyPair
      arguments:
        # arguments dictionary

    The following arguments are supported:

    KeyName string
    A unique name for the key pair. Constraints: Up to 255 ASCII characters
    KeyName string
    A unique name for the key pair. Constraints: Up to 255 ASCII characters
    keyName String
    A unique name for the key pair. Constraints: Up to 255 ASCII characters
    keyName string
    A unique name for the key pair. Constraints: Up to 255 ASCII characters
    key_name str
    A unique name for the key pair. Constraints: Up to 255 ASCII characters
    keyName String
    A unique name for the key pair. Constraints: Up to 255 ASCII characters

    getKeyPair Result

    The following output properties are available:

    KeyFingerprint string

    If you created the key pair using Amazon EC2:

    • For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .

    If you imported the key pair to Amazon EC2:

    • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .
    KeyPairId string
    The ID of the key pair.
    KeyFingerprint string

    If you created the key pair using Amazon EC2:

    • For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .

    If you imported the key pair to Amazon EC2:

    • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .
    KeyPairId string
    The ID of the key pair.
    keyFingerprint String

    If you created the key pair using Amazon EC2:

    • For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .

    If you imported the key pair to Amazon EC2:

    • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .
    keyPairId String
    The ID of the key pair.
    keyFingerprint string

    If you created the key pair using Amazon EC2:

    • For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .

    If you imported the key pair to Amazon EC2:

    • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .
    keyPairId string
    The ID of the key pair.
    key_fingerprint str

    If you created the key pair using Amazon EC2:

    • For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .

    If you imported the key pair to Amazon EC2:

    • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .
    key_pair_id str
    The ID of the key pair.
    keyFingerprint String

    If you created the key pair using Amazon EC2:

    • For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .

    If you imported the key pair to Amazon EC2:

    • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
    • For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8 .
    keyPairId String
    The ID of the key pair.

    Package Details

    Repository
    AWS Native pulumi/pulumi-aws-native
    License
    Apache-2.0
    aws-native logo

    We recommend new projects start with resources from the AWS provider.

    AWS Cloud Control v1.0.1 published on Tuesday, Oct 1, 2024 by Pulumi