问题
I can't connect to another ec2 instance in the same security group using public ip. If i try to connect using public DNS name and private ip, it is WORKING FINE. What i have done so far: * created two ec2 public instances. * attached both instances to security group sg-12345 * added inbound rules - all traffic,source=sg-12345 - SSH port=22,source= MY ip(this is to login into my ec2 instance from my desktop) Thanks in Advance.
回答1:
When you use public IP the traffic exits your VPC and comes back in, at which point it is no longer identified as coming from that security group. It looks just like random Internet traffic at that point. Stick to using private IP for both security and speed.
来源:https://stackoverflow.com/questions/44660616/cant-communicate-between-two-ec2-instances-in-the-same-security-group-via-publi