Connect to EC2 instance:
https://aws.amazon.com/console/ > Sign Into Console > All Services > Compute: EC2
https://console.aws.amazon.com/iam/home?#home > Users > [your user] > Security Credentials > Create access key
Go to EC2 Console, then:
Instances > Instances > Availability Zone
us-east-2b -> us-east-2 (drop the final letter)
╭─fenton@archlinux ~/.aws ‹master*› ╰─➤ aws configure AWS Access Key ID [None]: AKIAIFQXCHOQS5URLIOA AWS Secret Access Key [None]: 4/+NTasdfasdfsdafawer3q2w4rfasdf03 Default region name [None]: us-east-2 Default output format [None]: json ╭─fenton@archlinux ~/.aws ‹master*› ╰─➤ cat config [default] region = us-east-2 output = json ╭─fenton@archlinux ~/.aws ‹master*› ╰─➤ cat credentials [default] aws_access_key_id = AKIAIFQXCHOQS5URLIOA aws_secret_access_key = 4/+NTasdfasdfsdafawer3q2w4rfasdf03
$ aws ec2 describe-instances | jq '.Reservations | .[0].Instances | .[0].PublicDnsName'
Go to EC2 Console, then:
Network & Security > Key Pairs > Create Key Pair
Save to somewhere with 400 permissions,
╭─fenton@archlinux ~/.aws ‹master*› ╰─➤ ls -al /home/fenton/.ssh/for-amazon.pem -r-------- 1 fenton fenton 1.7K Oct 25 14:51 /home/fenton/.ssh/for-amazon.pem
then use that in your ssh call
$ ssh -i /home/fenton/.ssh/for-amazon.pem [email protected]