An EC2 Key Pair.
import { KeyPair } from 'aws-cdk-lib/aws-ec2';Or use the module namespace:
import * as ec2 from 'aws-cdk-lib/aws-ec2';
// ec2.KeyPairConfiguration passed to the constructor as KeyPairProps.
formatOptionalKeyPairFormatThe format of the key pair.
Default: PEM
keyPairNameOptionalstringA unique name for the key pair.
Default: A generated name
publicKeyMaterialOptionalstringThe public key material. If this is provided the key is considered "imported". For imported keys, it is assumed that you already have the private key material so the private key material will not be returned or stored in AWS Systems Manager Parameter Store.
Default: a public and private key will be generated
typeOptionalKeyPairTypeThe type of key pair.
Default: RSA (ignored if keyMaterial is provided)
ResourcePropsaccountOptionalinherited from ResourcePropsstringThe AWS account ID this resource belongs to.
Default: - the resource is in the same account as the stack it belongs to
environmentFromArnOptionalinherited from ResourcePropsstringARN to deduce region and account from. The ARN is parsed and the account and region are taken from the ARN. This should be used for imported resources. Cannot be supplied together with either `account` or `region`.
Default: - take environment from `account`, `region` parameters, or use Stack environment.
physicalNameOptionalinherited from ResourcePropsstringThe value passed in by users to the physical name prop of the resource. - `undefined` implies that a physical name will be allocated by CloudFormation during deployment. - a concrete value implies a specific physical name - `PhysicalName.GENERATE_IF_NEEDED` is a marker that indicates that a physical will only be generated by the CDK if it is needed for cross-environment references. Otherwise, it will be allocated by CloudFormation.
Default: - The physical name will be allocated by CloudFormation at deployment time
regionOptionalinherited from ResourcePropsstringThe AWS region this resource belongs to.
Default: - the resource is in the same region as the stack it belongs to
Everything you need to know about Amazon EC2 on one page. HD quality, print-friendly.
Download Free Infographicaws-ec2