aws-cdk-lib.aws_ec2.CfnKeyPairProps

interface CfnKeyPairProps

LanguageType name
.NETAmazon.CDK.AWS.EC2.CfnKeyPairProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnKeyPairProps
Javasoftware.amazon.awscdk.services.ec2.CfnKeyPairProps
Pythonaws_cdk.aws_ec2.CfnKeyPairProps
TypeScript aws-cdk-lib » aws_ec2 » CfnKeyPairProps

Properties for defining a CfnKeyPair.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const cfnKeyPairProps: ec2.CfnKeyPairProps = {
  keyName: 'keyName',

  // the properties below are optional
  keyFormat: 'keyFormat',
  keyType: 'keyType',
  publicKeyMaterial: 'publicKeyMaterial',
  tags: [{
    key: 'key',
    value: 'value',
  }],
};

Properties

NameTypeDescription
keyNamestringA unique name for the key pair.
keyFormat?stringThe format of the key pair.
keyType?stringThe type of key pair. Note that ED25519 keys are not supported for Windows instances.
publicKeyMaterial?stringThe public key material.
tags?CfnTag[]The tags to apply to the key pair.

keyName

Type: string

A unique name for the key pair.

Constraints: Up to 255 ASCII characters


keyFormat?

Type: string (optional)

The format of the key pair.

Default: pem


keyType?

Type: string (optional)

The type of key pair. Note that ED25519 keys are not supported for Windows instances.

If the PublicKeyMaterial property is specified, the KeyType property is ignored, and the key type is inferred from the PublicKeyMaterial value.

Default: rsa


publicKeyMaterial?

Type: string (optional)

The public key material.

The PublicKeyMaterial property is used to import a key pair. If this property is not specified, then a new key pair will be created.


tags?

Type: CfnTag[] (optional)

The tags to apply to the key pair.