Why can't I connect to my EC2 instance?

2 minute read

When I try to connect to my Amazon Elastic Compute Cloud (Amazon EC2) instance, I get an error.




Check that your EC2 instance passes status checks. For more information, see the following AWS Knowledge Center articles:

If your instance passes status checks and you get connection errors, then see the following Knowledge Center articles:

Related information

Troubleshoot EC2 instances (Linux)

Troubleshoot EC2 Windows instances

AWS OFFICIALUpdated 9 months ago

I have tha solution of this why ec2 instance is gives this error. You can simply go to the directory where your .Pem file is stored. and run command "chmod 400 <pemfile>" by giving these permission you can able to connect to your ec2 by ssh.

replied 10 months ago

Another point to add regarding issues with EC2 Instance Connect via AWS Management Console.

If you receive the following error when trying to connect to the instance:

Connection Error

Then it is likely that your Security Group was not properly configured.

EC2 Instance Connect uses specific IP address ranges for browser-based SSH connections to your instance (when users use the Amazon EC2 console to connect to an instance). If your users will use the Amazon EC2 console to connect to an instance, ensure that the security group associated with your instance allows inbound SSH traffic from the IP address range for EC2_INSTANCE_CONNECT. To identify the address range, download the JSON file provided by AWS and filter for the subset for EC2 Instance Connect, using EC2_INSTANCE_CONNECT as the service value. These IP address ranges differ between AWS Regions. For more information about downloading the JSON file and filtering by service, see AWS IP address ranges in the Amazon VPC User Guide.

To look for AWS IP address ranges for each service in each region, use the following JSON file available at https://ip-ranges.amazonaws.com/ip-ranges.json

For example, IP address range for the EC2 instance connect service at the us-east-1 region is:

us-east-1 IP address range

profile picture
replied 9 months ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
replied 9 months ago

Is there a youTube video or a training video that help with this? I am new to the entire AWS environment and it is not very newbie friendly with the navigation and menus. Been trying all the different options people recommended and now I think my account is a mess.

replied 9 months ago

you can learn the process from following youtube link https://www.youtube.com/watch?v=rtG8S5WsSHg&t=26s

replied 8 months ago

if you are new aws I would suggest attending the course from https://www.udemy.com/ .

for ec2 issue, Please check port 22 from security group

profile picture
replied 6 months ago

Hi, What's your error? Have you configured your SSH connections ?

profile picture
replied 2 months ago
  • Ensure that the security group attached to your instance allows access to port 22 for Linux and port 3389 for Windows.
  • Verify that your network access control list (network ACL) permits access to the instance.
  • Confirm that your route table has a route for the connection these are some solutions i can recommend you this video will help you https://www.youtube.com/watch?v=rtG8S5WsSHg&t=26s
profile picture
replied 22 days ago