A key pair in AWS EC2 is used to secure SSH access to an instance:
When launching an instance, you associate it with a key pair.
To connect to the instance, you use SSH and specify the path to the private key file, like so:
ssh -i /path/to/your-key.pem ec2-user@instance-public-dns