AWS VPC configuration

Hello, everyone!

I’d like to configure one vpc for spawning instances.
vpc CIDR:
route table, security group…
but here I need existing vpc check because we have a soft limitation of 5 VPC per region, so we cannot create one VPC per cluster.
What need to be done is to use an already existing VPC, and use a unique subnet per cluster (that should be enough isolation).
so if vpc already exist, we don’t need to create new vpc and just create subnet, route table, sg within it.
If anyone has approach on it, please help me.


if already exist you can subnets route table and Internet gateway and sg… thats it

To answer your question, I think we need to understand your use cases better. When you say you have a soft limitation of 5 VPCs per region - is that a company/department policy, or are you just hitting the AWS limit? For the latter, you can always request for a quota increase once you have reached 5 VPCs.

Are you looking to automate some sort of detection for the VPC and dynamically create subnets + other dependent resources? I have a feeling that Terraform might not be the best tool for the job. But if you must, you can perhaps use the cidrsubnets function and maintain a “subnet count”. This Reddit thread might give you more context.

And what is it that you are running in the “cluster”? Can resources in different clusters talk to each other? If you need to segregate the clusters, subnets are generally not the best option in a single-account environment due as it is tricky to get the security right.

In a multi-account environment backed by AWS Organizations, there’s a concept of VPC sharing. But you’d probably need a mature ops team to centrally manage the VPC and hand out access appropriate.

P.S. The VPC and subnet CIDRs seem off - you probably meant /16 for VPC and /24 for subnets.