Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EC2 instance connect : There was a problem setting up the instance connection

I launched a new Amazon Linux 2 instance. I tried connecting to the instance via the EC2 instance connect option under the Connect -> EC2 Instance Connect (browser-based SSH connection) option in the Management Console. I get the error:

There was a problem setting up the instance connection
An internal error has occurred within the remote server, and the connection has been terminated.
If this instance has just started up, try again in a minute or two.

The SSH port is open to the world(0.0.0.0/0). I am able to connect to EC2 instance with the SSH key configured via my local machines terminal but instance connect from the browser is not working.

like image 934
Omkar Avatar asked Jan 12 '20 07:01

Omkar


3 Answers

In order to connect to your instance with "EC2 Instance Connect (browser-based SSH connection)" you need to install ec2-instance-connect to your AMI.

Try connecting to your instance via "A standalone SSH client" (eg. putty) and installing it with a command:

sudo yum install ec2-instance-connect

or (for Ubuntu):

sudo apt-get install ec2-instance-connect 

To me this worked, and I could then easily access my instance via browser next time.

The more detailed explanation is found here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html

like image 133
Vladas O. Avatar answered Oct 12 '22 11:10

Vladas O.


Ensure that AMI is of Amazon Linux 2 type as it comes bundled with necessary softwares. Recently there is a change in AMI selection window where Ubuntu is pre-selected.

like image 24
Vicky Avatar answered Oct 12 '22 11:10

Vicky


Almost every time I've tried to use the SSH via Browser for EC2 never worked, like maybe 1-2 times, try to do it from terminal instead

like image 41
Iakovos Belonias Avatar answered Oct 12 '22 10:10

Iakovos Belonias