ec2_key_pair_info – List EC2 key pairs.¶
Retrieve information about AWS EC2 key pairs.
Examples¶
- name: List all EC2 key pairs
ec2_key_pair_info:
register: result
- name: List a specific EC2 key pair
ec2_key_pair_info:
names: my-first-keypair
register: result
- name: List information for multiple key pairs
ec2_key_pair_info:
names:
- my-first-keypair
- world-greeter
register: result
See Also¶
See also
Parameters¶
- auth (optional)
Parameters for authenticating with the AWS service. Each of them may be defined via environment variables.
type: dict- access_key (optional)
The AWS access key ID. If not set, the value of the AWS_ACCESS_KEY environment variable will be checked.
Mutually exclusive with profile.
type: str- profile (optional)
The name of the AWS profile configured with
aws configure
.Can be used instead of explicitly specifying your access credentials and region.
Use
default
to use the default profile.Mutually exclusive with access_key and secret_key.
type: str- region (optional)
The name of the AWS region.
If not set, the value of the AWS_REGION environment variable will be checked.
If you set a profile that specifies a default region, that region is used and you can omit this parameter. Use this parameter to override the profile’s default region.
type: str- secret_key (optional)
The AWS secret access key. If not set, the value of the AWS_SECRET_KEY environment variable will be checked.
Mutually exclusive with profile.
type: str- url (optional)
The URL to the AWS service related to the resource. By default, this is automatically determined through the region parameter.
If not set explicitly, the value of the AWS_<SERVICE>_URL environment variable will be used.
The services currently supported are EC2 and S3.
type: str
- names (optional)
The names of the keypairs to retrieve.
type: list
Return Values¶
- objects (success), list, {‘objects’: [{‘name’: ‘my-first-keypair’, ‘fingerprint’: ‘0a:ec:24:7b:69:ce:98:63:a4:ea:3c:e6:76:bb:6c:66:90:d0:33:ae’}]}
A list of objects representing EC2 key pairs.
Note that the private keys are not returned, as they are not stored by AWS EC2.
- name (always), str,
The name of the key pair.
- fingerprint (always), str,
This keypair’s fingerprint.
Note that AWS computes fingerprints in two different ways - for AWS-generated keys, fingerprints are computed with SHA1 on the _private_ keys, while for imported keys, fingerprints are computed with MD5 on the _public_ keys.