ssh into a running EC2 instance being used for an AWS Beanstalk deployment

The EB cli provides an ‘eb ssh env-name’ command to provide ssh access into a running EC2 instance. If the environment wasn’t setup to enable ssh, you’ll see this:

> eb ssh test
ERROR: This environment is not set up for SSH. Use "eb ssh --setup" to set up SSH for the environment.

After running ‘eb ssh –setup’ you’ll be prompted to confirm the environment name, and then select a previously configured SSH keypair to use to provide auth when logging on to the instance.

If an EC2 instance is already running in the env, this setup step configures new EC2 instances to enable ssh, and then conducts a rolling update to take down any previously started EC2 instances and replace them with new instances.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.