Skip to main content

key_pairs_list_only

Lists key_pairs in a region or regions, for all properties use key_pairs

Overview

Namekey_pairs_list_only
TypeResource
DescriptionSpecifies 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html#create-key-pair-cloudformation) 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.
Idaws.ec2.key_pairs_list_only

Fields

NameDatatypeDescription
key_namestringA unique name for the key pair.
Constraints: Up to 255 ASCII characters
regionstringAWS region.

Methods

NameAccessible byRequired Params
list_resourcesSELECTregion

SELECT examples

Lists all key_pairs in a region.

SELECT
region,
key_name
FROM aws.ec2.key_pairs_list_only
WHERE region = 'us-east-1';

Permissions

For permissions required to operate on the key_pairs_list_only resource, see key_pairs