0

I have 2 servers in different AZones in one region, they make an outgoing connections to my clients. Right now each server have it own Elastic IP, and an IP address from internal subnet for each AZ. (First AZ - 172.30.0.0/20, Second AZ - 172.30.16.0/20)

My goal is: make a NAT gateway, so all outgoing connections from these servers (in two AZones) goes thru NAT with one Elastic IP. As i understand right now - i can create NAT gateway only in one AZ, since i should choose Subnet.

Question: Is it possibe made a NAT gateway work with two subnets (in my case - two AZ)? Maybe i should create separate Subnet?

Please, help. Thanks in advance!

Zoe Keeper
  • 31
  • 1
  • 5

1 Answers1

0

You can create a NAT gateway for both AZs. You need a public subnet (e.g. a subnet that has an internet gateway). You put the NAT gateway in that subnet. The subnets that your EC2 instances are in should be part of a route table that routes 0.0.0.0 to the NAT gateway. Look at the diagram, and in fact the whole article, here:

NAT Gateways - Amazon Virtual Private Cloud

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
KyleM
  • 4,445
  • 9
  • 46
  • 78
  • Creating Public subnet for NAT gateway i should select an AZ (or Amazon choose it automatically). What will happen when, for an example this AZ become unavailable? My idea is: 2 servers in different AZones. Each EC2 server in it own subnet. (each AZ = Separate subnet). This two EC2 instances from different AZones and Subnets should make an outgoing connections thru NAT GW. So if one AZ become unavailable - server from second AZ continue to work thru NAT GW – Zoe Keeper Mar 11 '20 at 11:33