Enabling SSH Connections to an Elastic Beanstalk Environment
Overview
Notes on connecting to an AWS EC2 instance in order to manage and deploy web applications.
Connecting
c:\> ssh -i c:\users\damien\.ssh\nrosedevs-aws.pem ec2-user@[Public_DNS_address]
The Public DNS Address is retrieved from the AWS EC2 Dashboard, under Instances. Click on the individual instance to view its public DNS.
ec2-user is the user name for Amazon Linux servers. Other server types may have different user names, e.g. Ubuntu's user is ubuntu.
Troubleshooting
TK
Configuration
I had a hell of a time getting this to work using an existing EC2 instance. I ended up rebuilding the Key Pair, IAM Role, and EC2 instance. Then and only then did this work... actually come to think of it, I suspect that the problem might have been in the configuration of the EC2 instance. Where the directions say to select Enable for the Auto-assign Public IP, initially I left it at the default setting. I can't see a way of going back and changing this setting once the instance is created.
When a Key Pair is created through the AWS management console, a .pem file containing the pair is generated.
This file is created once, and cannot be generated again at a later date.
Save the .pem file (c:\users\damien\.ssh\).
The AWS documentation stresses using PuTTY on Windows, but it's possible to use a Powershell prompt also. Maybe the Powershell prompt isn't as secure?
PuTTY uses a .ppk file to hold the key pair, while the Powershell prompt uses the .pem file.
Prerequisites
- A running EC2 instance
- EC2 dashboard
- Navigation pane > Instances > Instances
- Confirm that the EC2 instance exists, and that it is running.
- Retrieve the public DNS for the EC2 instance from this page.