SSH key pairs consist of a public key and a private key, serving as a secure lock and key system.There are two methods to obtain SSH keys for EC2 instances: the AWS console method and generating your own keys.When using SSH keys with Terraform, you can add your public key to AWS and use it in EC2 instances.Using SSH keys is more secure than passwords as the private key never travels over the network and each connection uses a new challenge.