VPC Peering three peering connections (CIDR)

We have three serverless environments:

  • development
  • test
  • production

All live in different aws accounts. We need to setup VPC peering with the same mongo db cluster.

I’m no expert when it comes to VPC networks.

How would I configure the CIDR ranges of my AWS VPCs to not generate overlap?

Currently I have:

development: 10.0.0.0/16
test: 192.168.0.0/16
production: 172.16.0.0/16

However setting up the test env VPC peering, errors because of CIDR overlap. Our MongoDB cluster’s CIDR is 192.168.240.0/21

I can change all the AWS environments VPCs, but I can’t change the Mongo Cluster. How would I need to setup/reduce the CIDR ranges for development, test and production?

Any help would be appreciated.

Thank you.

EDIT For clarification: The environments do not need to talk to each other, they all must only connect to the Mongo cluster

Have you looked at using Atlas Private Endpoints instead?