How to open traffic between 2-Ec2 instances via internal private IPs


I have 2 ec2 instances that are needed to communicate as backend servers. They are both attached to the same security group which has a inbound rule allowing for all ports on the VPC's CIDR range. So the CIDR range is for all ports.

The program is that when I ping instance 1 from instance 2 using the internal IP address, the ping fails. I'm not sure why that fails. Any help would be great.

2 Answers

The /32 CIDR range only allows a single host in the range. VPC CIDR ranges are typically between /16 and /24. If you want all hosts associated to the security group to communicate with each other on all ports and protocols you will need to expand the CIDR range to match the CIDR of your VPC (i.e. something like or you can self reference the security group id as the source in the rule rather than a CIDR range. See this documentation.

profile picture
answered a month ago

/32 mean single IP address. won't much with any EC2 instance. You have to create rule for each server. Ex: First EC2 Second EC2

answered a month ago
  • What if I know that all the EC2s will be on the same VPC and will all have private IPs within the range of Is there not a way to specify everything within that range?

  • Please see my answer below for a link to AWS docs but the short of it is you need the rule CIDR range to match your VPC CIDR. Assuming your VPC is defined as this is what your rule should reflect. Or you can self reference the security group and not deal with CIDR ranges at all.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions