Enabling SSH Connections to an Elastic Beanstalk Environment: Difference between revisions
(Created page with "Category:AWS Category:Web Development == Overview == Notes on connecting to an AWS EC2 instance in order to manage and deploy web applications. == Connecting == <sy...") |
No edit summary |
||
| Line 3: | Line 3: | ||
Notes on connecting to an AWS EC2 instance in order to manage and deploy web applications. | Notes on connecting to an AWS EC2 instance in order to manage and deploy web applications. | ||
== Prerequisites == | |||
Steps to configure EC2 connections.<ref>[http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html Connecting to Your Linux Instance from Windows Using PuTTY] (AWS documentation)</ref> | |||
* '''Get the ID of the EC2 instance''' Amazon EC2 console > Instance ID column (or use `describe-instances` from the AWS CLI) | |||
* '''Get the public DNS of the instance''' Amazon EC2 console > Public DNS column (optionally click show/hide and select Public DNS column) | |||
* '''Private key''' Fully-qualified path to `.pem` file for key pair specified when the instance was launched. | |||
* '''Enabled inbound SSH traffic from your IP address to the instance''' Ensure the security group associated with the instance allows incoming traffic from the local IP address.<ref>[http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html Authorizing Network Access to your Instances]</ref> | |||
== Connecting == | == Connecting == | ||
Revision as of 02:44, 6 February 2016
Overview
Notes on connecting to an AWS EC2 instance in order to manage and deploy web applications.
Prerequisites
Steps to configure EC2 connections.[1]
- Get the ID of the EC2 instance Amazon EC2 console > Instance ID column (or use
describe-instancesfrom the AWS CLI) - Get the public DNS of the instance Amazon EC2 console > Public DNS column (optionally click show/hide and select Public DNS column)
- Private key Fully-qualified path to
.pemfile for key pair specified when the instance was launched. - Enabled inbound SSH traffic from your IP address to the instance Ensure the security group associated with the instance allows incoming traffic from the local IP address.[2]
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.