- Newest
- Most votes
- Most comments
Yes, it is possible to route traffic from a specific IP address over your site-to-site VPN while using NAT. Here's how you can approach this:
-
Create a new subnet in your VPC with a smaller CIDR block (e.g., /28) that includes the /32 private IP address the vendor offered for NAT.
-
Deploy a private NAT gateway in this new subnet. This NAT gateway will be assigned the /32 private IP address.
-
Update your route tables:
- In the route table for your workload subnets (where your servers are), add a route for the vendor's public IP (/32) pointing to the new NAT gateway.
- In the route table for the new subnet with the NAT gateway, add a route for the vendor's public IP (/32) pointing to your Virtual Private Gateway (VGW) where the VPN tunnel terminates.
-
Ensure that the VPN tunnel's configuration includes a route for the new subnet's CIDR block.
-
On the vendor's side, they should configure their VPN endpoint to route traffic destined for your new NAT gateway's IP through the VPN tunnel.
This setup will allow traffic destined for the vendor's public IP to be routed through the NAT gateway and then over the VPN, appearing to come from the /32 private IP address they specified. All other traffic will continue to use your existing routing, including traffic through your load balancer.
It's important to note that this configuration uses the NAT gateway's private IP, not a public IP. The NAT gateway will only use its public IP (Elastic IP) when routing traffic to the internet through an Internet Gateway in the same VPC.
If you absolutely need to use a public IP as the source over the VPN, you would need to add a small block of public IPs (that you own) to your VPC and use those for the NAT gateway. However, this is more complex and usually not necessary for private VPN connections.
Remember to test thoroughly after implementation to ensure all routing behaves as expected.
Sources
Route Egress Traffic through NAT Gateway to VPN Gateway | AWS re:Post
Public IP as source over transit gateway | AWS re:Post
NAT gateway use cases - Amazon Virtual Private Cloud
Example routing options - Amazon Virtual Private Cloud
answered 2 years ago
- Which route table did you add the /32 to?
- Are your servers in a public or private subnet?
Relevant content
asked 5 years ago
asked 2 years ago

The AI Agent has got the question confused. It thinks your question is about the source IP not the DST IP