amazon-web-servicesamazon-ecsssh-keys

Unable to use browser for EC2 AWS login with inbound rule including my own IPv4


all. I am new to AWS and have limited tech support knowledge, so please bear with me. I recently created an AWS account for personal (not business) related reasons. I am using EC2, and Linux for the AMI. I am only able to connect through the browser if my inbound rules are set as

  1. SSH TCP any IPv4
  2. same rules for HTTP.

If I select "my IPv4" for either of these options, I am unable to connect to the instance and instead get an error message:

EC2 Instance Connect is unable to connect to your instance. Ensure your instance network settings are configured correctly for EC2 Instance Connect. For more information, see EC2 Instance Connect Prerequisites at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-prerequisites.html.

Review of this link does not result in an obvious culprit for what I am doing incorrectly. I likewise tried PuTTY and used the generator to change the RSA .pem to a .ppk file, but when I do this it appears to launch then asks me to "log in"? and does not look like the instance when I log in through the browser (with IPv4 set to any). What am I doing wrong?

I am not handling any sensitive data, but it would probably be better if I did not have the IP set to any. When I change the instance inbound rules to "any" for the IPv4, I am able to log in through the browser. Traveling to a different location and adding a new rule for the new IP does not resolve the problem, nor does using my phone as a hot spot. I have tried both Chrome (my default) and Edge.

Any help is greatly appreciated. Thank you.

Background: Running Windows 12.


Solution

  • As mentioned in the document that 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.

    If you are only keeping SSH to myIP address then from terminal of your local machine, you will be able to access the instance but as you are using EC2_INSTANCE_CONNECT you need to add the IP range of EC2_INSTANCE_CONNECT in the security group as inbound rule as well along with your IP.