# KeyPairFormat

The format of the Key Pair.

- Source: [`aws-ec2/lib/key-pair.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/key-pair.ts#L16)
- Type last changed: v2.116.0 · 22 Dec 2023

## Example

```ts
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;

const keyPair = new ec2.KeyPair(this, 'KeyPair', {
  type: ec2.KeyPairType.ED25519,
  format: ec2.KeyPairFormat.PEM,
});
const instance = new ec2.Instance(this, 'Instance', {
  vpc,
  instanceType,
  machineImage: ec2.MachineImage.latestAmazonLinux2023(),
  // Use the custom key pair
  keyPair,
});
```

## Members

| Member | Description |
| --- | --- |
| `PPK` | A PPK file, typically used with PuTTY. |
| `PEM` | A PEM file. |

## Referenced by

- [`KeyPair`](/v2/docs/aws-cdk-lib.aws_ec2.KeyPair).format
- [`KeyPairProps`](/v2/docs/aws-cdk-lib.aws_ec2.KeyPairProps).format
