I have two AWS accounts (A and B). Each of them has a VPC with no overlapping CIDR blocks, both are in the same region. I have successfully created a VPC peering connection between them (which is active). The requester and receiver both allow remote vpc dns resolution.
I have specified in each VPC table routes the other's VPC cidr block as a destination with the peering connection as a target.
I have an EC2 instance running in a public subnet inside the VPCA of AccountA, attached to a security group SecurityGroupA. SecurityGroupA enables inbound from all sources in the default security group of VPCA, as well as inbound from AccountBId/SecurityGroupB, and all outbounds.
I have a RDS postgres instance running in the VPCB of AccountB, attached to a security group SecurityGroupB. SecurityGroupB enables inbound TCP on port 5432 (postgres default port) from AccountAId/SecurityGroupAId.
When running aws ec2 describe-security-group-references --group-id SecurityGorupAId
, I get
{
"SecurityGroupReferenceSet": [
{
"GroupId": "SecurityGroupAId",
"ReferencingVpcId": "VPCBId",
"VpcPeeringConnectionId": "pcx-XXXXXXXXXXXXXXXXX"
}
]
}
Which seems to indicate that the security group is correctly referenced. But when trying to connect from the EC2 instance to the RDS instance, I'm getting a connection timed out error.