A company is migrating a legacy application that requires static IP addresses for its clients' firewall whitelisting. The application will be hosted on EC2 instances behind a Network Load Balancer (NLB) in a private subnet. Which approach should the company use to provide static IP addresses for outbound traffic?
NAT Gateway with an Elastic IP provides a static source IP for outbound traffic from private subnets.
Why this answer
A NAT Gateway in a public subnet with an Elastic IP provides a static source IP address for outbound traffic from private subnets. Since the EC2 instances are in a private subnet behind an NLB, they cannot directly reach the internet; the NAT Gateway translates their private IPs to the Elastic IP, which clients can whitelist. This ensures consistent outbound IPs without exposing the instances to inbound traffic.
How to eliminate wrong answers
Option A is wrong because assigning Elastic IPs to EC2 instances in a private subnet does not provide outbound internet access; Elastic IPs only work for instances in public subnets with an internet gateway, and private subnets lack a direct route to the internet. Option B is wrong because an internet-facing NLB with Elastic IPs handles inbound traffic, not outbound; it cannot provide a static source IP for outbound connections initiated by the instances. Option C is wrong because a VPC endpoint is used for private connectivity to AWS services (e.g., S3, DynamoDB) over the AWS network, not for general outbound internet traffic to external clients.