0
votes

How to ping an EC2 instance A from instance B running in the same VPC, same subnet but different security group in AWS, both are running on the public subnet, I am able to ping to the instance A private IP from B if I add the CIDR blocking range of the VPC but not the public IP and I want to hit the public IP

1
What are the ingress and egress rules on the SGs?Marcin
ingress rules means ? i have put all traffic icmp but not put 0.0.0.0 i have just put the instance B security group in itVatsal Rahul
Instance B can keep on keep on changing but the security group will remain the sameVatsal Rahul
I don't understand. If you don't allow 0.0.0.0/0 how would ping over the public IP exactly accessed the instance?Marcin
That works , i have checked but the instances will keep on changing so their public ip will also changeVatsal Rahul

1 Answers

0
votes

Based on the comments.

The issue was caused by blocking 0.0.0.0/0 on instance B. The solution was to add a rule to the B's security group allowing traffic from its public IP.

In case of internet traffic, rules cannot reference each other by security groups. The SG to SG traffic is only for private IP addresses.