简体   繁体   中英

How to access AWS EC2 instance from web browser on Linux machine?

When I try to connect to my EC2 instance using web browser (Mozilla Firefox) using the third option in the connect (EC2 Instance Connect (browser-based SSH connection) ), I get the following error in the new pop-up window:

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.

Some things to check:

  • Make sure the instance was launched from Amazon Linux 2 or Ubuntu 16.04 or later
  • Check that the instance is in a public subnet (defined as having a Route Table that points to an Internet Gateway)
  • Open the Security Group for SSH (port 22) either for the whole Internet ( 0.0.0.0/0 ) (which is a very poor choice for security) or from the IP address ranges for EC2 Instance Connect (See: AWS IP Address Ranges - AWS General Reference )

EC2 Instance Connect in your browser establishes a web connection to the AWS service. Then, the SSH connection is established from the AWS Service to the Amazon EC2 instance. This is why the security group needs to allow incoming connections from the IP address range associated with the EC2 Instance Connect Service (not your own IP address).

Alternative ways to connect are:

  • Run an SSH client on your computer, or
  • Use AWS Systems Manager Session Manager (which connects via an Agent running on the computer, so it's not 'real' SSH)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM