AWS, EC2

Create AWS Keypair with AWS CLI

Summary

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.

Prerequisite

AWS CLI

Create

aws ec2 create-key-pair --key-name aws-keypair-test --query 'KeyMaterial' --output text > aws-keypair-test.pem

Validate

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

Delete

aws ec2 delete-key-pair --key-name aws-keypair-test

Source: https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-keypairs.html

Leave a Reply

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami