Create AWS Keypair with AWS CLI
A key pair, consisting of a private key and a public key, is a set of security credentials that you use to prove your identity when connecting to an instance. Amazon EC2 stores the public key, and you store the private key. You use the private key, instead of a password, to securely access your instances. Anyone who possesses your private keys can connect to your instances, so it’s important that you store your private keys in a secure place.
aws ec2 create-key-pair --key-name aws-keypair-test --query 'KeyMaterial' --output text > aws-keypair-test.pem
A “fingerprint” is generated from your key pair, and you can use it to verify that the private key that you have on your local machine matches the public key that’s stored in AWS.
aws ec2 describe-key-pairs --key-name MyKeyPair
aws ec2 delete-key-pair --key-name aws-keypair-test