title: How to configure EC2 security group to permit loopback via public IP address?
body: <p>I have to run a program on an EC2 that reads the host's public IP address from config (which I don't appear to be able to easily change), and then connects to it, i.e. it's looping back to the instance via the public IP address.</p>
  
  <p>I can't find out how to create a security group that can loopback to the the EC2 instance. My rules are:</p>
  
  <p>outbound: 0.0.0.0/0 all tcp
  inbound: [private IP/32, 127.0.0.1/32, public IP/32] all tcp 4440 (the port I need)</p>
  
  <p>None of the inbound IPs work. I'm testing this by telnetting on the host to the public IP: <code>telnet x.x.x.x 4440</code>, and I'm never able to (where <code>x.x.x.x</code> is my public IP). I can do it by specifying <code>127.0.0.1</code> though, so the server I'm connecting to is online and bound correctly. I can also access the server through my browser. I just can't loopback. The connection hangs, which is why I think it's a security group issue.</p>
  
  <p>How can I allow this program - which tries to connect to the public IP from the instance - to connect to the same instance by its public IP address?</p>