Enabling SSH Connections to an Elastic Beanstalk Environment: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Line 48: Line 48:
*** Confirm that the EC2 instance exists, and that it is running.
*** Confirm that the EC2 instance exists, and that it is running.
*** Retrieve the '''public DNS''' for the EC2 instance from this page.
*** Retrieve the '''public DNS''' for the EC2 instance from this page.
== Notes ==
<references />

Revision as of 13:05, 20 March 2018

Overview

Notes on connecting to an AWS EC2 instance in order to manage and deploy web applications. [1]

Prerequisites

Steps to configure EC2 connections.[2]

  • 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.[3]

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.

Notes