KeyPairFormat

class aws_cdk.aws_ec2.KeyPairFormat(value)

Bases: Enum

The format of the Key Pair.

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc
# instance_type: ec2.InstanceType


key_pair = ec2.KeyPair(self, "KeyPair",
    type=ec2.KeyPairType.ED25519,
    format=ec2.KeyPairFormat.PEM
)
instance = ec2.Instance(self, "Instance",
    vpc=vpc,
    instance_type=instance_type,
    machine_image=ec2.MachineImage.latest_amazon_linux2023(),
    # Use the custom key pair
    key_pair=key_pair
)

Attributes

PEM

A PEM file.

PPK

A PPK file, typically used with PuTTY.