How to Create KeyPair for EC2 on Amazon Web Service(AWS).
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.
PEM (Privacy Enhanced Mail) is a base64 container format for encoding keys and certificates. . pem download from AWS when you created your key-pair. This is only a one time download and you cannot download it again.
PPK(Putty Private Key) is a windows ssh client, it does not support . pem format.
- Login to aws portal.
- Click on Services.
- Under Compute select EC2.
- Click on KeyPairs.
- Click on Create Keypair.
- Provide Keypair name.
- Select file format like : pem or ppk.
- PEM file use with SSH or PPK use with Putty.
- Click on Add tag.
- Provide key name & value for key pair.
- Then click on create key pair.
- After sometime key pair is ready.
Create KeyPair using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
aws ec2 create-key-pair –key-name keypair_name