class CfnKeyPairPropsMixin
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Mixins.Preview.AWS.EC2.Mixins.CfnKeyPairPropsMixin |
Go | github.com/aws/aws-cdk-go/awscdkmixinspreview/v2/awsec2/mixins#CfnKeyPairPropsMixin |
Java | software.amazon.awscdk.mixins.preview.services.ec2.mixins.CfnKeyPairPropsMixin |
Python | aws_cdk.mixins_preview.aws_ec2.mixins.CfnKeyPairPropsMixin |
TypeScript | @aws-cdk/mixins-preview » aws_ec2 » mixins » CfnKeyPairPropsMixin |
Implements
IMixin
Extends
Mixin
Specifies a key pair for use with an Amazon Elastic Compute Cloud instance as follows:.
- To import an existing key pair, include the
PublicKeyMaterialproperty. - To create a new key pair, omit the
PublicKeyMaterialproperty.
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 also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { mixins } from '@aws-cdk/mixins-preview';
import { mixins as ec2_mixins } from '@aws-cdk/mixins-preview/aws-ec2';
const cfnKeyPairPropsMixin = new ec2_mixins.CfnKeyPairPropsMixin({
keyFormat: 'keyFormat',
keyName: 'keyName',
keyType: 'keyType',
publicKeyMaterial: 'publicKeyMaterial',
tags: [{
key: 'key',
value: 'value',
}],
}, /* all optional props */ {
strategy: mixins.PropertyMergeStrategy.OVERRIDE,
});
Initializer
new CfnKeyPairPropsMixin(props: CfnKeyPairMixinProps, options?: CfnPropertyMixinOptions)
Parameters
- props
Cfn— L1 properties to apply.Key Pair Mixin Props - options
Cfn— Mixin options.Property Mixin Options
Create a mixin to apply properties to AWS::EC2::KeyPair.
Properties
| Name | Type | Description |
|---|---|---|
| props | Cfn | |
| strategy | Property | |
| static CFN_PROPERTY_KEYS | string[] |
props
Type:
Cfn
strategy
Type:
Property
static CFN_PROPERTY_KEYS
Type:
string[]
Methods
| Name | Description |
|---|---|
| apply | Apply the mixin properties to the construct. |
| supports(construct) | Check if this mixin supports the given construct. |
applyTo(construct)
public applyTo(construct: IConstruct): IConstruct
Parameters
- construct
IConstruct
Returns
Apply the mixin properties to the construct.
supports(construct)
public supports(construct: IConstruct): boolean
Parameters
- construct
IConstruct
Returns
boolean
Check if this mixin supports the given construct.

.NET
Go
Java
Python
TypeScript