Problem scenario
You cannot reach the public IP address of an EC-2 instance. You get "Network connection timed out" errors. The EC-2 instance is in a VPC. You have configured the relevant Network ACLs of the VPC and the EC-2 instance's Security Groups to allow connectivity from your workstation. What could be wrong?
Solution
- Make sure you have an Internet Gateway that has been created and attached to the relevant VPC. To do this you would go to the VPC Dashboard and go to "Internet Gateways". Then click "Create internet gateway". Once it has been created, click on the radio button of the internet gateway, then go to Actions -> "Attach to VPC". Choose the VPC that is relevant.
- Make sure you have Route Tables associated with the VPC that include a target to the Internet Gateway configured earlier (e.g., in #1). The Internet Gateway should be attached to the relevant VPC. You may want to have traffic destined for 0.0.0.0/0 (any traffic) to be routed to the Internet Gateway. This is not the most secure way, but for convenience, this may be how you set it up.