Specifies a key pair for use with an EC2long instance as follows:
PublicKeyMaterial
property.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.
resource "awscc_ec2_key_pair" "example" {
key_name = "example"
public_key_material = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"
tags = [{
key = "Modified By"
value = "AWSCC"
}]
}
key_name
(String) A unique name for the key pair.
Constraints: Up to 255 ASCII characterskey_format
(String) The format of the key pair.
Default: pem
key_type
(String) The type of key pair. Note that ED25519 keys are not supported for Windows instances.
If the PublicKeyMaterial
property is specified, the KeyType
property is ignored, and the key type is inferred from the PublicKeyMaterial
value.
Default: rsa
public_key_material
(String) The public key material. The PublicKeyMaterial
property is used to import a key pair. If this property is not specified, then a new key pair will be created.tags
(Attributes Set) The tags to apply to the key pair. (see below for nested schema)id
(String) Uniquely identifies the resource.key_fingerprint
(String)key_pair_id
(String)tags
Required:
key
(String) The tag key.value
(String) The tag value.Import is supported using the following syntax:
$ terraform import awscc_ec2_key_pair.example <resource ID>