tomraithel
tomraithel

Reputation: 968

AWS: SSH to EC2 with Elastic Beanstalk Command Line Interface (EB CLI) 3.x

I created a new Elastic Beanstalk (eb) application with Elastic Beanstalk Command Line Interface (EB CLI) Version 3.x.

Everything works so far, but I want to know how I can access the EC2-instance via SSH without using the eb ssh command. Reason is, I want to open a connection with sshfs.

What I know is, that the eb commandline tool uses a aws-eb keypair, which is located in my ~/.ssh folder. I tried to connect to the EC2 by calling ssh -i ~/.ssh/aws-eb [email protected] but nothing happens.

Upvotes: 1

Views: 4690

Answers (1)

Nick Humrich
Nick Humrich

Reputation: 15785

You need to connect to the ec2 instance directly using its public ip address. You can not connect using the elasticbeanstalk url.

You can find the instance ip address by looking it up in the ec2 console.

You also need to make sure port 22 is open. By default the EB CLI closes port 22 after a ssh connection is complete. You can call eb ssh -o to keep the port open after the ssh session is complete.

Warning: You should know that elastic beanstalk could replace your instance at anytime. State is not guaranteed on any of your elastic beanstalk instances. Its probably better to use ssh for testing and debugging purposes only, as anything you modify can go away at any time.

Upvotes: 7

Related Questions