1. Generate key
ssh-keygen -t rsa -b 4096 -C "<email address>"
AWS Dashboard > EC2 > Key Pairs > Upload
You can check the fingerprint with:
openssl rsa -in path_to_private_key -pubout -outform DER | openssl md5 -c
It’s important to use the correct
openssl command. There are 2 separate commands – one for an AWS generated key and the second for a key you upload.
3. add the
key_name to Terraform
e.g. a launch configuration:
4. ssh in with
ssh -i ~/.ssh/<new-key> ec2-user@<public ip>
If you’re unable to connect make sure you’ve got port 22 open on the EC2 instance Security Group.
E.g. Inbound rule:
SSH TCP 22 22.214.171.124/32 SSH from laptop