On AWS EC2, I cannot do wget or curl, or any outbound connection

Khom Nazid picture Khom Nazid · Oct 11, 2015 · Viewed 12.7k times · Source

On a freshly installed EC2:

  1. The Security Group is default. "All Traffic" is ALLOWed for 0.0.0.0/0 for both Inbound and Outbound.

  2. The "Network ACL" has some limitations for inbound as we want our website on this domain to be an internal network for our charity organisation. But from this server, we want to install some things via SSH so we need wget and curl. So the Outbound is also

    100 ALL Traffic 0.0.0.0/0 ALLOW

    • ALL Traffic 0.0.0.0/0 DENY

That last "DENY" is added by default.

With these settings, which seems to be quite normal, what else am I missing? Note that all iptables rules are flushed, and we do not use iptables to the best of my knowledge. All firewall stuff is managed by the Amazon VPC security settings.

Any thoughts or pointers? Thank you.

Answer

John Rotenstein picture John Rotenstein · Oct 12, 2015

It appears that you are able to connect to your instance (via ssh or RDP), but you cannot access Internet resources from the instance. If so, things to check are:

  • Inbound Security Group: Not relevant (but probably OK since you are able to connect to the instance)
  • Outbound Security Group: Allow 0.0.0.0/0
  • Network Access Control Lists (NACLs): Start by allowing all traffic in & out to get things working, then limit them later per requirements. This is the default setting, too (as you listed, above)
  • Assign a public IP address (either when launching, or as an Elastic IP Address). If you are able to connect to the instance, then this is fine.
  • Launch the instance in a Public Subnet, which means the subnet has a rule in the Route Table that directs traffic to the Internet Gateway (if you are able to connect to the instance, then this is fine)

The fact that you can connect INWARDS suggests that your network settings are all correct. Being unable to initiate an OUTWARDS connection is normally due to an Outbound Security Group setting.