key_pair#
State module for managing EC2 Key Pairs
hub.exec.boto3.client.ec2.create_key_pair hub.exec.boto3.client.ec2.delete_key_pair hub.exec.boto3.client.ec2.describe_key_pairs hub.exec.boto3.client.ec2.import_key_pair resource = hub.tool.boto3.resource.crate(ctx,”ec2”, “KeyPair”, name)
- async idem_aws.states.aws.ec2.key_pair.present(hub, ctx, name: str, public_key: str, resource_id: str = None, tags: Dict[str, str] = None) Dict[str, Any] [source]#
Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified PEM or PPK format that you can use with an Amazon EC2 instance.
A key pair is used to control login access to EC2 instances. The key pair is available only in the Amazon Web Services Region in which you create it.
Currently, this resource requires an existing user-supplied key pair. This key pair’s public key will be registered with AWS to allow logging-in to EC2 instances. When importing an existing key pair the public key material may be in any format supported by AWS. Supported formats are described in Amazon docs: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#how-to-generate-your-own-key-and-import-it-to-aws For more information, see the Amazon ec2 Developer Guide. Please note that, for security reasons, you cannot download the keypairs themselves. You’ll simply be given their name and fingerprint.
- Parameters:
name (str) – The name for your new key pair.
public_key (str) – The public key material.
resource_id (str, Optional) – The key pair id.
tags (Dict, Optional) –
dict of tags to assign to the key pair in the format of
{"tag-key": "tag-value"}
or dict in the format of{tag-key: tag-value}
. Defaults to None.- tag-key (str):
The key of the tag. Tag keys are case-sensitive and accept a maximum of 127 Unicode characters.
- tag-value (str):
The value of the tag. Tag values are case-sensitive and accept a maximum of 255 Unicode characters.
- Request Syntax:
[key_pair_name]: aws.ec2.key_pair.present: - resource_id: 'string' - name: 'string' - public_key: 'string' - tags: Dict[str, str] 'string': 'string' 'string': 'string'
- Returns:
Dict[str, Any]
Examples
resource_is_present: aws.ec2.key_pair.present: - name: value - public_key: value - tags: first_key: first_value second_key: second_value
- async idem_aws.states.aws.ec2.key_pair.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any] [source]#
Deletes the specified key pair.
- Parameters:
- Request Syntax:
[key_pair_name]: aws.ec2.key_pair.absent: - resource_id: 'string' - name: 'string'
- Returns:
Dict[str, Any]
Examples
resource_is_absent: aws.ec2.key_pair.absent: - resource_id: idem-test-key_pair - name: idem-test-key_pair
- async idem_aws.states.aws.ec2.key_pair.describe(hub, ctx) Dict[str, Dict[str, Any]] [source]#
Describe the resource in a way that can be recreated/managed with the corresponding “present” function
Returns information about all key pairs in the user’s account.
- Returns:
Dict[str, Any]
Examples
$ idem describe aws.ec2.key_pair