EC2 Key Pairs

Create

The following commands assume you are on Linux and you want to create a Key Pair named after your login user...

cd ~/.ssh
aws ec2 create-key-pair --key-name $(whoami) --query 'KeyMaterial' --output text > $(whoami).pem
chmod 400 $(whoami).pem
aws ec2 describe-key-pairs --key-name $(whoami)

Delete

If you ever need to delete your key pair use...

aws ec2 delete-key-pair --key-name MyKeyPair