---
type: resource-type
title: KeyPair
description: aws resource type AWS::EC2::KeyPair
name: KeyPair
lexicon: aws
resource_type: AWS::EC2::KeyPair
---
`AWS::EC2::KeyPair`, a resource type of the aws lexicon.

## Properties

- `KeyName` (`string`, required): A unique name for the key pair. Constraints: Up to 255 ASCII characters
- `KeyFingerprint` (`string`, optional)
- `KeyFormat` (`"pem" | "ppk"`, optional): The format of the key pair. Default: ``pem``
- `KeyPairId` (`string`, optional)
- `KeyType` (`"ed25519" | "rsa"`, 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` (`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` (`KeyPair_Tag[]`, optional): The tags to apply to the key pair.

## Attributes

- `KeyFingerprint`
- `KeyPairId`
