# KeyPairAttributes

Attributes of a 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#L86)
- Type last changed: v2.116.0 · 22 Dec 2023

## Example

```ts
const keyPair = ec2.KeyPair.fromKeyPairAttributes(this, 'KeyPair', {
  keyPairName: 'the-keypair-name',
  type: ec2.KeyPairType.RSA,
})
```

## Properties

- `keyPairName`: string (required) — The unique name of the key pair.

- `type`: [KeyPairType](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.KeyPairType.html) — The type of the key pair.

  **Default:** no type specified
