EC2 inbound from security group not working - what

2019-04-07 23:55发布

问题:

I have two instances.

IOne is in us-east-1b and is in security group 'bamboo'

ITwo is in us-east-1c and is in security group 'ssh from bamboo'

In ssh from bamboo I allow inbound traffic on port 22 from group 'bamboo'

This results in IOne getting timeouts when trying to SSH into ITwo

If I change the security rule to the IP address of IOne instead of the group name, the SSH connection succeeds.

I read that the two machines have to be in the same region (though it doesn't mention zones). Should my above setup work? If not what would I need to change?

回答1:

You can't use the public IP, but you can use the public hostname (ec2-IPADDRESS-.us-east-1.compute.amazonaws.com) because this will resolve to the internal IP address when called from inside EC2, and will resolve to the external IP from outside Amazon's network.



回答2:

Maybe this answer is late but @datasage probably was right. You need to use your private IP and not the public or Elastic IP

From the AWS EC2 documentation:

Incoming traffic is allowed based on the private IP addresses of the instances that are associated with the source security group (and not the public IP or Elastic IP addresses).