Saturday, November 02, 2013

AWS Instances in Same Security Group Can't Connect to Each Other

I was setting up two databases in the same security group to try to migrate data from one to the other - both installed on EC2 instances, not RDS. I couldn't initially ping one machine from the other, even though I had opened up the firewall. I guess I assumed two machines in the same security group would be able to talk to each other...not the case. To resolve this I put the security group into itself in the security group configuration for both inbound and outbound traffic and then it worked.

In other words:

Edit your security group, click on details and copy the group id.

Click on the inbound tab.

Add a rule to allow whatever traffic you want to go from one server in the group into another server in the group and add the security group id as the source.





Click on the outbound tab and repeat.

Assuming you've set up appropriate firewall rules you should now be able to ping one box from another to verify the connection is working.