VPC with peering vs one bigger VPC?

,

Hi,

I considered having 2 separate AWS dev and test environments. However, the cost of having two RDS, DocumentDB clusters and MSK clusters became too large. Therefore I’d like to use same databases in TEST and DEV environments. Test is also used internally so there’s no risk in breaking it. However I’m not sure which is a better approach to connect test and dev vpcs with peering or simple move applications into VPC?

Use an ‘AWS Transit Gateway’ to connect all your VPCs together. You can terminate your ’Site to Site’ VPN tunnel to the TGW too. TGW can also connect cross account VPCs. So you don’t even need to keep different environments in the same account. This is what we do for ourselves.
I recommend at least VPC separation of prod vs non-prod. Ideally, each env with it’s own vpc within its own account

I would think about using two as you night want a Dev db later down the track we also use it for a permission segregation line. You get access to this account but not this one etc.

+1 for transit gateway, this will solve the networking issues and it does work cross account, like the other user mentioned. You can still go cross account using the same DB if you are using Aurora by using RAM. https://docs.aws.amazon.com/ram/latest/userguide/shareable.html

You can simply create the DB in one account, and share the DB cluster with the other account(s).

Would he have to do that NAT thing? Or worry about the VPCs having clashing subnets?

I have multiple VPCs and peering for test, dev and a couple of others things because I wanted to run the different functions in different AWS accounts with shared billing. I also have a core VPC which runs all the shared services (the RDS, etc in your case). The various subnets have access to their own resources and the shared ones through peering but direct access between the different VPCs is limited. It’s a nice way to ensure that, for example, tests are not relying on a dev resource without you knowing about that.

With any sort of VPC connectivity you need non-overlapping IP CIDR blocks.

While using TGW you would probably want to have a ‘Shared Services VPC’. This would have the NAT gateways in the public subnets. All other private subnets in other VPCs would have a default route pointing to the TGW. And, in the TGW you would have the default route pointing to the ‘Shared Services VPC’. And, finally the private subnets of the shared services VPC (which are the ones actually attached to the TGW) have the default route pointing to the NAT GWs in it’s public subnets

Apologies for the block if text. I’m on the phone.

If you start to do peering between accounts, you lose the isolation. If you do this, why not just run dev/test under the same account.

I don’t like peering and only use it for centralized logging.

I don’t disagree with you, but tend to take this approach to limit blast-radius of a compromised account. You can only tell a client so many times not to check IAM keys into version control so many times. My usual approach is a management account and one for each SDLC env.

It also does cross region by TGW peering :smiley: