In AWS, these keys are used for encrypting and decrypting. Here, the sender uses public key for encrypting the data and at the receiver side, they use private key to decrypt the data. These 2 keys are known as key pairs. Key pairs are essential for connecting the EC2 instances.
Creating a secured key pair:
1.Launch an EC2 instance. While providing the keypair, create a new key pair and give a name and launch.
2 Go to PuttyGen>load>click on all files>search for the downloaded .pem key file>open>Provide password>confirm the password> save as private key with some name.
For reference, please refer to the image attached.
For more information, check out this AWS Tutorial.