In my previous post we learned how to convert PEM formatted key pair to PPK. This time we’re going learn how to SSH from Powershell to EC2 instance.
Want to check all my AWS posts?
Please click this link.
What is AWS Key Pair?
A key pair consisting of a public key and a private key. A set of security credentials that you use to prove your identity when connecting to an Amazon EC2 instance. Amazon EC2 stores the public key on cloud server and you store the private key.
Anyone with a private key can connect to your cloud servers. So it’s important to keep your private key in a safe place. Important note, AWS only allows you to download the private key once. Take care not to lose it.
For more information about AWS EC2 Key Pairs please check this link.
Before establishing the connection, it is useful to note the path where you store your key pair.
Example: C:\aws\key\aws-test.pem
Important: If your path have spaces you have to type your path like this: “C:\aws test\key\aws-test.pem”
Only option we need is -i (identity_file)
Username for Amazon Linux EC2 instances is ec2-user. It is important to remember this.
Finally, we need the public IP of the EC2 instance. When creating EC2, it automatically assigns a public IP. If a public IP is not assigned somehow, you can assign an IP from the Elastic IP tab.
Important note about Elastic IPs, it is free as long as one IP stays connected to EC2 instances. If you terminate the instance, do not forget to delete the Elastic IP.
When we combine all these, we get the command below.
ssh -i C:\aws\key\aws-test.pem ec2-user@3.72.41.232