When you launch an EC2 instance, it’s publicly accessible over the internet if not properly configured.
AWS provides tools like Key Pairs, Security Groups, and Elastic IPs to manage access and protect your instances.
Key Pairs are used to securely connect (SSH) to your EC2 instance.
They consist of two parts:
🧠 Purpose:
Instead of using a password, AWS uses asymmetric encryption (public/private key model) for login security.
Option 1: AWS Console
.pem file (only available once)Option 2: AWS CLI
aws ec2 create-key-pair --key-name myKeyPair --query 'KeyMaterial' --output text > myKeyPair.pem