- Newest
- Most votes
- Most comments
Please verify that your EC2 instance has a public IP address assigned, and that your subnet's Network ACL allows all traffic inbound and outbound (default settings). You can narrow that down later but for now leave it open.
Hello,
To troubleshoot why your Amazon EC2 can't access the internet, do the following:
- Verify that the instance has a public IP address.
- Verify that the outbound rules of the security group bound to the instance do not block access.
Verify that the instance has a public IP address
If the instance in a public subnet doesn't have a public IP address, then the instance isn't accessible outside the virtual private cloud (VPC) where it resides in. This is true even if the instance has an internet gateway.
To allow the instance connectivity to the internet, allocate an Elastic IP address, and then associate this Elastic IP address with the instance.
If you do not want to provide a public IP for the instance, you can also try adding a NAT Gateway to the VPC, and then change the route for the subnet where your instance is located from the Internet Gateway to the NAT Gateway.
Verify that the outbound rules of the security group bound to the instance do not block access.
The security group for the elastic network interface attached to the instance must have a rule that allows outbound internet traffic (0.0.0.0/0) for your port and protocol.
The following blog links may be helpful to you:
https://repost.aws/knowledge-center/ec2-connect-internet-gateway
Relevant content
- asked 2 years ago
- asked 2 years ago
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 25 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago