amazonka-ec2-2.0: Amazon Elastic Compute Cloud SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.EC2.CreateKeyPair

Description

Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified PEM or PPK format. Amazon EC2 stores the public key and displays the private key for you to save to a file. The private key is returned as an unencrypted PEM encoded PKCS#1 private key or an unencrypted PPK formatted private key for use with PuTTY. If a key with the specified name already exists, Amazon EC2 returns an error.

The key pair returned to you is available only in the Amazon Web Services Region in which you create it. If you prefer, you can create your own key pair using a third-party tool and upload it to any Region using ImportKeyPair.

You can have up to 5,000 key pairs per Amazon Web Services Region.

For more information, see Amazon EC2 key pairs in the Amazon Elastic Compute Cloud User Guide.

Synopsis

Creating a Request

data CreateKeyPair Source #

See: newCreateKeyPair smart constructor.

Constructors

CreateKeyPair' 

Fields

  • dryRun :: Maybe Bool

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • keyFormat :: Maybe KeyFormat

    The format of the key pair.

    Default: pem

  • keyType :: Maybe KeyType

    The type of key pair. Note that ED25519 keys are not supported for Windows instances.

    Default: rsa

  • tagSpecifications :: Maybe [TagSpecification]

    The tags to apply to the new key pair.

  • keyName :: Text

    A unique name for the key pair.

    Constraints: Up to 255 ASCII characters

Instances

Instances details
ToHeaders CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

ToPath CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

ToQuery CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

AWSRequest CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Associated Types

type AWSResponse CreateKeyPair #

Generic CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Associated Types

type Rep CreateKeyPair :: Type -> Type #

Read CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Show CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

NFData CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Methods

rnf :: CreateKeyPair -> () #

Eq CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Hashable CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

type AWSResponse CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

type Rep CreateKeyPair Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

type Rep CreateKeyPair = D1 ('MetaData "CreateKeyPair" "Amazonka.EC2.CreateKeyPair" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "CreateKeyPair'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "dryRun") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "keyFormat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe KeyFormat))) :*: (S1 ('MetaSel ('Just "keyType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe KeyType)) :*: (S1 ('MetaSel ('Just "tagSpecifications") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [TagSpecification])) :*: S1 ('MetaSel ('Just "keyName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

newCreateKeyPair Source #

Create a value of CreateKeyPair with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:dryRun:CreateKeyPair', createKeyPair_dryRun - Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

$sel:keyFormat:CreateKeyPair', createKeyPair_keyFormat - The format of the key pair.

Default: pem

CreateKeyPair, createKeyPair_keyType - The type of key pair. Note that ED25519 keys are not supported for Windows instances.

Default: rsa

CreateKeyPair, createKeyPair_tagSpecifications - The tags to apply to the new key pair.

CreateKeyPair, createKeyPair_keyName - A unique name for the key pair.

Constraints: Up to 255 ASCII characters

Request Lenses

createKeyPair_dryRun :: Lens' CreateKeyPair (Maybe Bool) Source #

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

createKeyPair_keyFormat :: Lens' CreateKeyPair (Maybe KeyFormat) Source #

The format of the key pair.

Default: pem

createKeyPair_keyType :: Lens' CreateKeyPair (Maybe KeyType) Source #

The type of key pair. Note that ED25519 keys are not supported for Windows instances.

Default: rsa

createKeyPair_keyName :: Lens' CreateKeyPair Text Source #

A unique name for the key pair.

Constraints: Up to 255 ASCII characters

Destructuring the Response

data CreateKeyPairResponse Source #

Describes a key pair.

See: newCreateKeyPairResponse smart constructor.

Constructors

CreateKeyPairResponse' 

Fields

  • keyPairId :: Maybe Text

    The ID of the key pair.

  • tags :: Maybe [Tag]

    Any tags applied to the key pair.

  • httpStatus :: Int

    The response's http status code.

  • keyName :: Text

    The name of the key pair.

  • keyFingerprint :: Text
    • 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.
  • keyMaterial :: Sensitive Text

    An unencrypted PEM encoded RSA or ED25519 private key.

Instances

Instances details
Generic CreateKeyPairResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Associated Types

type Rep CreateKeyPairResponse :: Type -> Type #

Show CreateKeyPairResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

NFData CreateKeyPairResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

Methods

rnf :: CreateKeyPairResponse -> () #

Eq CreateKeyPairResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

type Rep CreateKeyPairResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateKeyPair

type Rep CreateKeyPairResponse = D1 ('MetaData "CreateKeyPairResponse" "Amazonka.EC2.CreateKeyPair" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "CreateKeyPairResponse'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "keyPairId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Tag])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))) :*: (S1 ('MetaSel ('Just "keyName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "keyFingerprint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "keyMaterial") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Sensitive Text))))))

newCreateKeyPairResponse Source #

Create a value of CreateKeyPairResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

CreateKeyPairResponse, createKeyPairResponse_keyPairId - The ID of the key pair.

CreateKeyPairResponse, createKeyPairResponse_tags - Any tags applied to the key pair.

$sel:httpStatus:CreateKeyPairResponse', createKeyPairResponse_httpStatus - The response's http status code.

CreateKeyPair, createKeyPairResponse_keyName - The name of the key pair.

CreateKeyPairResponse, createKeyPairResponse_keyFingerprint - - 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.

$sel:keyMaterial:CreateKeyPairResponse', createKeyPairResponse_keyMaterial - An unencrypted PEM encoded RSA or ED25519 private key.

Response Lenses

createKeyPairResponse_tags :: Lens' CreateKeyPairResponse (Maybe [Tag]) Source #

Any tags applied to the key pair.

createKeyPairResponse_keyFingerprint :: Lens' CreateKeyPairResponse Text Source #

  • 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.

createKeyPairResponse_keyMaterial :: Lens' CreateKeyPairResponse Text Source #

An unencrypted PEM encoded RSA or ED25519 private key.