CfnKeyPairPropsMixin

class aws_cdk.mixins_preview.aws_ec2.mixins.CfnKeyPairPropsMixin(props, *, strategy=None)

Bases: Mixin

Specifies a key pair for use with an Amazon Elastic Compute Cloud 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. AWS CloudFormation 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 AWS Systems Manager 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 CloudFormation in the Amazon EC2 User Guide .

When CloudFormation 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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html

CloudformationResource:

AWS::EC2::KeyPair

Mixin:

true

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview import mixins
from aws_cdk.mixins_preview.aws_ec2 import mixins as ec2_mixins

cfn_key_pair_props_mixin = ec2_mixins.CfnKeyPairPropsMixin(ec2_mixins.CfnKeyPairMixinProps(
    key_format="keyFormat",
    key_name="keyName",
    key_type="keyType",
    public_key_material="publicKeyMaterial",
    tags=[CfnTag(
        key="key",
        value="value"
    )]
),
    strategy=mixins.PropertyMergeStrategy.OVERRIDE
)

Create a mixin to apply properties to AWS::EC2::KeyPair.

Parameters:
  • props (Union[CfnKeyPairMixinProps, Dict[str, Any]]) – L1 properties to apply.

  • strategy (Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE

Methods

apply_to(construct)

Apply the mixin properties to the construct.

Parameters:

construct (IConstruct)

Return type:

IConstruct

supports(construct)

Check if this mixin supports the given construct.

Parameters:

construct (IConstruct)

Return type:

bool

Attributes

CFN_PROPERTY_KEYS = ['keyFormat', 'keyName', 'keyType', 'publicKeyMaterial', 'tags']

Static Methods

classmethod is_mixin(x)

(experimental) Checks if x is a Mixin.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Mixin.

Stability:

experimental