NAT and private service access
Two ways to reach a service
A VM without a public IP may still need to reach a package repository or an object storage API. Outbound network address translation (NAT) can let a private client initiate connections to public destinations. A private endpoint instead supplies a private network path to a particular supported service. Choose based on required destinations, policy, availability and cost. Neither path removes the need for TLS or service authorization.
Example: the bookstore API fetches a public software update through outbound NAT and writes receipts to private object storage through a service endpoint, if supported. The database has no general internet egress requirement.
Follow a translated connection
In a fictional IPv4 flow, 10.42.1.20:51000 connects to 198.51.100.40:443. An outbound NAT mapping might translate its source to 203.0.113.8:62001. A matching response goes back to that external tuple and is translated to the original client. These external addresses are reserved documentation addresses, not real targets.
Managed outbound NAT does not normally allow unsolicited inbound connections through that mapping. It is not a general firewall, a content scanner, an identity check or a guarantee against data exfiltration. Restrict egress according to workload needs and observe unexpected connections. Source ports are finite; many concurrent connections can exhaust allocations. Check metrics, connection reuse and service-specific allocation limits rather than guessing a universal port capacity.
Provider-specific NAT models
AWS public NAT gateways support outbound connectivity from private workloads with appropriate routing and an internet gateway for internet access. AWS private NAT gateways address different private connectivity needs; do not confuse them with public egress. Check the chosen gateway mode and fault scope.
Azure NAT Gateway provides outbound source translation for supported subnet resources; effective routes can direct traffic elsewhere. Google Cloud Public NAT provides distributed outbound translation for eligible resources without external IPv4 addresses; it is not a VM that packets must physically traverse. Google Cloud also has separate private NAT modes. Verify subnet eligibility, IP families, availability, route selection and allocated ports for the chosen service. Do not copy an AWS routing diagram as the implementation of Azure or GCP.
Private endpoints, DNS and identity
An AWS PrivateLink interface endpoint uses endpoint network interfaces with private addresses and applicable security groups. Private DNS can map supported service names to those interfaces. Gateway endpoints for supported services such as S3 and DynamoDB are a different mechanism with route-table integration.
An Azure Private Endpoint uses a private network interface in a virtual network to reach a specific supported Private Link resource. Configure the intended DNS resolution and separately review or disable public access at the service where supported; creating an endpoint does not by itself prove the public path is closed. Azure service endpoints are a distinct feature, not private endpoint interfaces.
Google Cloud Private Service Connect offers consumer endpoints for supported published services or Google APIs; a forwarding rule references the appropriate target. Check acceptance state for published services, service scope and DNS configuration. Private Google Access is a separate capability.
Across providers, a private IP path is not a permission grant. Resolve the original service hostname to the intended private address, verify TLS hostname validation, check endpoint and service policies where supported, and use short-lived authorized workload credentials. Keep public access policy and network path verification separate.
Work a cost and resilience example
Use fictional prices in dollars, not provider quotes. Assume a dedicated NAT path costs $0.04/hour plus $0.05 per GB processed; a private endpoint costs $0.015/hour plus $0.01 per GB. Both exist for 720 hours; the workload processes 200 GB total (requests plus responses). NAT: 720 × 0.04 + 200 × 0.05 = $38.80. Endpoint: 720 × 0.015 + 200 × 0.01 = $12.80. Difference: $26.00.
If the NAT gateway is already required for other workloads and cannot be removed, its hourly fee is not saved by moving this traffic. The avoided variable charge is $10.00, versus $12.80 in new endpoint fees: the simplified incremental change is $2.80 more. Security or resilience may still justify the endpoint.
Official rate dimensions reviewed 2026-11-28 include hourly and data processing fees, public IP charges, transfer and cross-zone charges where applicable; Google Cloud NAT also has assigned-instance and external-address billing dimensions. Endpoint charges depend on type and placement. These example GB units and rates are hypothetical; real providers may use GiB and tiered rates. Check official pricing, regional service support, number of endpoints and redundancy before approving deployment.
Troubleshoot the intended private path
If the service cannot be reached: first check the hostname resolves to the intended private address from the workload context. Check route selection, effective network policies, endpoint state and service health. Then verify TLS and application authorization. A DNS answer alone proves neither reachability nor permissions. A service-generated HTTP 403 can indicate that the network path succeeded but the service rejected access; check the origin of the response before concluding.
For the offline exercise, classify which destinations require public egress, which support private endpoints, and which should be denied. Compare full and marginal cost. Document cleanup of lab-owned endpoints, NAT, public addresses and DNS configuration, preserving shared resources. No real cloud calls or configuration changes are required.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
NAT and private service access — knowledge check
Choose the best answer for each offline scenario.
What is the primary purpose of outbound source NAT?
What must be verified after configuring a private endpoint?
A dedicated NAT path costs $0.04/hour and $0.05/GB. What is its fictional cost for 720 hours and 200 GB?
An existing NAT must remain for other traffic. Moving 200 GB avoids $10 of NAT processing and adds $12.80 in endpoint fees. What is the change?
Which claim about private access is correct?