Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EC2 Instance Connect (browser-based SSH connection) doesn't work

Tags:

amazon-ec2

Platform: Amazon Linux

Connection method: EC2 Instance Connect (browser-based SSH connection)

Error: There was a problem setting up the instance connection Log in failed. If this instance has just started up, try again in a minute or two.

Note: I am able to connect via Putty / SSH Client. But same instance can't connect via browser.

When checked network logs in browser's developer tool, see a Status Code: 400 Bad Request for following URL:

https://ec2-instance-connect.us-east-2.managed-ssh.aws.a2z.com/ls/api/tokens

like image 625
user3731930 Avatar asked Feb 26 '26 09:02

user3731930


2 Answers

To test, I just did the following:

  • Launched an Amazon Linux 2 EC2 instance with the default security group
  • Clicked "Connect" in the EC2 management console
  • Selected "EC2 Instance Connect"
  • Clicked "Connect"

A new browser tab opened and a few seconds later I had a working SSH connection.

I then tried it again with an Amazon Linux (not Amazon Linux 2) instance and got the error:

There was a problem setting up the instance connection
Log in failed. If this instance has just started up, try again in a minute or two.

This is because the EC2 Instance Connect client is only pre-installed on Amazon Linux 2 and Ubuntu 16.04 or later.

like image 194
John Rotenstein Avatar answered Mar 02 '26 16:03

John Rotenstein


This is for AWS Lightsail, I could not use browser to connect via SSS, instead I was able to connect via SSH using macOS terminal. I was able to login via SSH by appending my public key id_rsa.pub contents to the remote authorized_keys file, I used SFTP (Filezilla) to update authorized_keys file. For SFTP connection I downloaded ssh key from Accounts page.

like image 32
atazmin Avatar answered Mar 02 '26 16:03

atazmin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!