A key pair is used to control login access to EC2 instances. Currently this resource requires an existing user-supplied key pair. This key pair's public key will be registered with AWS to allow logging-in to EC2 instances. When importing an existing key pair the public key material may be in any format supported by AWS. Amazon EC2 uses public as well as private keys to encrypt and decrypt the login information. The sender use public key to encrypt and reciever uses private key to decrypt.The public key enables us to access the instance securely and a private key used instead of passwords.