简体   繁体   中英

AWS VPC have a single external IP for a outbound traffic

I have a VPC with a public subnet and an internet gateway.

Route table is configured to route 0.0.0.0/0 with Internet Gateway. Currently instances has access to the internet and are accessible from the outside via instance public IP address.

What I am trying to achieve is:

  • instances in the public subnet should still be accessible from the internet via instance public IP address
  • but all outbound traffic from instance should be routed through a single point and all outbound traffic should have a single IP address.

I am aware that I could configure route table to use NAT for 0.0.0.0/0 and all outbound traffic will have a NAT's IP address, but in this case instances are not accessible from the outside via instance public IP.

The normal way to achieve this is by deploying your EC2 instances in a private subnet behind a load balancer for ingress traffic and then to use a NAT Gateway for the egress traffic from the EC2 instances to the rest of the world.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM