Issue
When I configure the security group with ssh protocol, port range 22 and I select MyIP, which is using my IP as I checked, the Ec2 Instance Connect does not work.
Anyone else has experienced this? What is the work around? Having a static Ip address?
Solution
This is expected behaviour.
When doing a "normal" SSH connection from your own computer to an Amazon EC2 instance, the connection goes directly from your computer to the EC2 instance. Thus, the Security Group needs to permit the Inbound connection from the public IP address associated with your computer.
However, when using EC2 Instance Connect, an HTTPS connection is established between your computer and the EC2 Instance Connect Service inside AWS. That Service then establishes an SSH connection to the EC2 instance. Thus, the connection comes from the Service, rather than your own computer.
Therefore, the Security Group should permit inbound connections from the IP address range of the EC2 Instance Connect Service.
You can obtain these addresses from:
- AWS IP address ranges - AWS General Reference
- Search for
EC2_INSTANCE_CONNECT
- Select the range for your applicable region
Answered By - John Rotenstein Answer Checked By - Katrina (WPSolving Volunteer)