Skip to content
v2.278.0

KeyPairAttributes Struct ​

Attributes of a Key Pair.

Example ​

ts
const keyPair = ec2.KeyPair.fromKeyPairAttributes(this, 'KeyPair', {
  keyPairName: 'the-keypair-name',
  type: ec2.KeyPairType.RSA,
})
python
key_pair = ec2.KeyPair.from_key_pair_attributes(self, "KeyPair",
    key_pair_name="the-keypair-name",
    type=ec2.KeyPairType.RSA
)
java
IKeyPair keyPair = KeyPair.fromKeyPairAttributes(this, "KeyPair", KeyPairAttributes.builder()
        .keyPairName("the-keypair-name")
        .type(KeyPairType.RSA)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var keyPair = KeyPair.FromKeyPairAttributes(this, "KeyPair", new KeyPairAttributes {
    KeyPairName = "the-keypair-name",
    Type = KeyPairType.RSA
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
keyPair := ec2.KeyPair_FromKeyPairAttributes(this, jsii.String("KeyPair"), &KeyPairAttributes{
	KeyPairName: jsii.String("the-keypair-name"),
	Type: ec2.KeyPairType_RSA,
})

Properties ​

keyPairNamestringkey_pair_namestrkeyPairNameStringKeyPairNamestringKeyPairName*string required #
The unique name of the key pair.
typeoptionalKeyPairTypetypeoptionalKeyPairTypetypeoptionalKeyPairTypeTypeoptionalKeyPairTypeTypeoptionalKeyPairType #
The type of the key pair.

Default: no type specified