Reputation: 1032
I have one VPC where i configured NAT Gateway. Another VPC(s) do not have any "public subnet" nor IGW. I would like to share single NAT Gateway among many VPCs. I tried to configure Routing table but it does not allow to specify NAT Gateway from different VPC. As posible solution, I installed http/s proxy in VPC with IGW and configured proxy settings on every instance in different VPC. It worked, but I would like use NAT Gateway due to easier management. Is it possible to make this kind of configuration at AWS? There are few VPCs and I do not want to add NAT Gateway to each VPC.
Zdenko
Upvotes: 3
Views: 10476
Reputation: 179084
You can't share a NAT Gateway among multiple VPCs.
To access a resource in another VPC without crossing over the Internet and back requires VPC peering or another type of VPC-to-VPC VPN, and these arrangements do not allow transit traffic, for very good reasons. Hence:
You can't route traffic to a NAT gateway through a VPC peering connection. You can't route traffic through a NAT Gateway when traffic arrives over a hybrid connection (Site to Site VPN or Direct Connect) through a Virtual Private Gateway. You can route traffic through a NAT Gateway when traffic arrives over a hybrid connection (Site to Site VPN or Direct Connect) through a transit gateway.
https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-basics.html
The instances in the originating VPC are, by definition, "on the other side of" one of the listed interconnection arrangements.
Upvotes: 8
Reputation: 1552
It may be a bit complicated to setup but running an OpenVPN server in the VPC with the IGW and connecting instances in the VPC without IGW to the vpn server might be a solution.
Upvotes: 0
Reputation: 781
You basically have 3 options
Upvotes: 4
Reputation: 3352
AWS Transit Gateway now provides an option to do what you wish, although you will want to consider the costs involved -- there are hourly and data charges. There is a reference architecture published in which multiple VPCs share a NAT gateway without allowing traffic between the VPCs:
Upvotes: 5