Is there any approach to replace NAT Gateway?

Khaleel Shaik 20 Reputation points
2025-04-09T03:03:41.1866667+00:00

We currently have a NAT Gateway configured to manage outbound traffic for one of our Azure App Services. However, since the NAT Gateway is one of the most expensive resources in our setup, we're looking for a more cost-effective alternative that can serve the same purpose. Any suggestions or guidance would be greatly appreciated.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,640 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Siva Nair 1,235 Reputation points Microsoft External Staff
    2025-04-10T05:09:25.65+00:00

    Hi Khaleel Shaik,

    In addition to Luke Murray response,

    we recommend replacing the NAT Gateway with a lightweight Linux VM acting as a NAT instance. This setup uses VNet Integration, a User Defined Route (UDR), and standard Linux NAT capabilities. while maintaining control over outbound IPs from Azure App Services

    Do follow configure-virtual-machine-software

    1. Enable VNet Integration

    In the App Service, go to Networking → VNet Integration

    Integrate with a VNet and select a dedicated subnet

    1. Provision the NAT VM

    Create a Linux VM (Ubuntu/Debian recommended) in the same VNet or a peered VNet

    Assign a Standard SKU Static Public IP

    1. Configure NAT with iptables

    User's image

    1. Create a User Defined Route (UDR)
    • Create a route table and a route for all traffic:
    az network route-table create \
                     --resource-group test-rg \
                     --name route-table-nat-hub \
                     --location eastus2
    

    Associate the route table with the subnet used by VNet Integration

    1. Update NSG Rules (if any)
    • Ensure that traffic is allowed:
      • From App Service subnet → NAT VM (private IP)
      • From NAT VM → Internet
      • From Internet → NAT VM (optional, for testing/monitoring)
    1. we can test it by Deploy an endpoint in the App Service that calls: test-nat-gateway-from-spoke-one
    
    https://whatsmyip.com
    

    This should return the static public IP of the NAT VM, confirming that traffic is routing correctly.

    If you have any further assistant, do let me know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.