Cloud Networking and VPC Design Questions
Designing networks inside a cloud provider: VPC/VNet topology, subnets, route tables, gateways, NAT, and peering, plus private connectivity through VPC endpoints and cloud load balancers. Covers segmentation, security groups and network ACLs, hybrid connectivity to on-premises data centers over VPN or dedicated links like Direct Connect and ExpressRoute, IP address planning across many VPCs and accounts, and how cloud network design differs from traditional data-center networking.
Design a VPC architecture for a three-tier web application expected to handle 1,000 requests per second, requiring high availability across 3 Availability Zones, private databases, public web tier, and secure admin access. Specify subnets, route tables, NAT placement, load balancing, bastion/jump hosts, and how you'd minimize blast radius while keeping operational simplicity.
Sample Answer
Direct answer
For a 3-tier web application at 1,000 requests per second (RPS) with a hard requirement of surviving an Availability Zone (AZ) failure, the design is: one public and two private subnets replicated identically across 3 AZs, a Layer-7 load balancer fronting the web tier, private database subnets, no standing bastion (identity-based session access instead), and one NAT (Network Address Translation) gateway per AZ so egress (traffic leaving the VPC toward the internet or another network) does not become a cross-AZ single point of failure. Blast radius (how much of the system a single failure or compromise can actually reach) stays small because each tier only trusts the tier directly upstream of it, and operational simplicity comes from replicating one AZ's pattern three times rather than inventing per-AZ variations.
Structured elaboration
Subnets and route tables. Per AZ: one public subnet (load balancer, NAT gateway), one private application subnet, one private database subnet. That is 9 subnets across 3 AZs for a minimal version; teams that also want a dedicated subnet for interface VPC (Virtual Private Cloud) endpoints or a transit gateway attachment add a 4th subnet per AZ. Each AZ's private subnets route 0.0.0.0/0 to that AZ's own NAT gateway, never a neighboring AZ's, so a NAT gateway failure or an AZ outage only removes egress for resources already in that AZ (which have lost their AZ anyway).
Load balancing. An Application Load Balancer (ALB), Layer 7, spans all 3 public subnets and distributes across web-tier targets in all 3 AZs. Health checks against the web tier's actual health endpoint (not just a TCP port check) let the load balancer stop routing to an AZ whose instances are up but unhealthy. At 1,000 RPS sustained, capacity planning matters more than the load balancer choice: size the web and app tiers' Auto Scaling groups off a load test at that RPS with headroom for burst, not off a guess.
Bastion / admin access and blast radius. No public bastion host. Administrators reach private instances through an identity-based session broker (AWS Systems Manager Session Manager or the equivalent on other clouds) that requires no inbound port on any instance, is authenticated and authorized through the same identity and access management (IAM) system as everything else, and logs every session centrally. This removes one more always-on internet-facing target and ties access revocation to identity, not to a shared key.
Minimizing blast radius, concretely, beyond subnet placement:
- Security groups chained tier to tier (load balancer accepts internet, web/app accept only the security group directly upstream, database accepts only the app tier's security group), so compromising the web tier does not hand an attacker a direct path to the database.
- Egress minimized with VPC endpoints instead of the NAT gateway wherever the destination is a same-provider managed service. A Gateway Endpoint for object storage (S3) is free and keeps that traffic off the NAT gateway and the public internet entirely; interface endpoints for a container registry and for the security token service used to assume roles keep image pulls and credential exchange off the public path too, which shrinks the set of destinations the app tier's outbound rule needs to allow.
- A web application firewall (WAF) and a content delivery network (CDN) in front of the ALB absorb common Layer-7 attacks and static-asset load before it ever reaches the compute tiers, which is a network-relevant addition worth naming even though the CDN itself is a separate service: it changes what "blast radius" means for the web tier, since a volumetric or bot-driven spike is partly absorbed upstream.
- A caching tier (for example, an in-memory cache) sits in a private subnet of its own, reachable only from the app tier's security group, for the same reason the database is isolated: it holds derived data and often session state, so it deserves the same no-direct-internet-path treatment as the database, not the app tier's.
Worked example
graph TD
INTERNET((Internet)) --> WAF[WAF and CDN]
WAF --> ALB[ALB - 3 public subnets]
ALB --> WEB1[Web tier AZ-a/b/c]
WEB1 --> APP1[App tier AZ-a/b/c]
APP1 --> CACHE[(Cache tier - private)]
APP1 --> DB[(Primary DB with Multi-AZ standby)]
APP1 --> EP[VPC endpoints: S3, ECR, STS]
APP1 --> NAT[Per-AZ NAT gateways]
Cost vs availability, with real numbers. NAT gateways are billed per hour plus per gigabyte processed (roughly $0.045/hour and $0.045/GB in most US regions; verify current pricing before budgeting, since it does move). One NAT gateway shared across 3 AZs costs about $32/month in the hourly charge alone and creates the cross-AZ single point of failure described above; three NAT gateways, one per AZ, costs roughly 3x that hourly charge but removes the single point of failure and keeps each AZ's egress traffic on that AZ's own path. At 1,000 RPS with any meaningful east-west traffic to the internet, the AZ-outage risk of the shared design is the more expensive failure mode in practice, so per-AZ NAT is the default recommendation here; a single shared NAT gateway is only defensible for a genuinely non-critical, cost-sensitive workload that has already accepted an AZ outage as a tolerable, if painful, event. The same logic applies to the database: a Multi-AZ managed database costs roughly double a single-AZ instance (you are paying for a synchronously replicated standby that does no work most of the time), but for a database backing a 1,000 RPS production tier, an unplanned single-AZ database outage is not an acceptable trade against that incremental cost, so Multi-AZ is the default here too. Both of these are the same underlying trade: pay a roughly linear cost increase to remove a single point of failure whose failure mode (a full AZ outage) is rare but not rare enough to design around ignoring.
Trade-offs and pitfalls
The most common failure in designs at this scale is passing the load test at 1,000 RPS against a single AZ and never testing what happens when one AZ is pulled out of rotation entirely: Auto Scaling groups, connection pools, and the load balancer's health-check grace period all behave differently under a real AZ failure than under a synthetic load test. A second pitfall is over-indexing on the bastion-vs-session-manager decision while leaving the actual database security group wide open to the whole VPC CIDR (the VPC's entire IP address range) "temporarily" during a migration and forgetting to tighten it back. Finally, teams sometimes add VPC endpoints for cost savings but forget that an interface endpoint's DNS still needs to resolve correctly for private hosted zones, so mid-migration, some calls silently keep going out over the NAT gateway (working, just not cheaper) until DNS is fully cut over, which is worth checking explicitly rather than assuming the endpoint is being used just because it exists.
You must design an IP address allocation plan for 200+ VPCs across 10 regions and multiple accounts so that VPC CIDR ranges never overlap and expansion is possible. Propose a CIDR allocation strategy, delegation model or IPAM approach, and automated guardrails to prevent collisions when teams provision new VPCs.
Sample Answer
Direct answer
Solve this by carving a single, never-touched supernet into fixed-size blocks up front, at two levels (one block per Region, then one block per VPC within that Region), and enforce that allocation through an IP address management (IPAM) tool rather than by convention, so no team can ever hand-pick a CIDR (Classless Inter-Domain Routing) range that happens to collide with another. Manual spreadsheet-based allocation is the thing that fails at this scale; the fix is automated, tool-enforced delegation.
Structured elaboration
CIDR allocation strategy. Start from one enterprise-wide supernet from the private address space, for example 10.0.0.0/8. Split it into per-Region blocks: a /8 divides cleanly into 16 blocks of /12, computed as 2(12−8)=16, comfortably covering 10 Regions with 6 blocks held in reserve for future growth. Within each Region's /12, split further into per-VPC blocks: a /12 divides into 256 blocks of /20 (4,096 addresses each), computed as 2(20−12)=256, which covers well over 200 VPCs per Region with enormous headroom, and a /20 is large enough for a realistic multi-AZ (Availability Zone), multi-tier subnet layout inside a single VPC without needing to resize it later (VPC CIDR blocks cannot be resized once created; only additional, non-overlapping secondary blocks can be added).
| Level | Block size | Blocks available | Purpose |
|---|---|---|---|
| Enterprise supernet | /8 | 1 | Root allocation, never assigned directly |
| Per-Region | /12 | 16 (need 10) | One reserved block per Region, with spares |
| Per-VPC | /20 | 256 per Region | One block per VPC, sized for real subnet layouts |
Delegation model or IPAM approach. A centralized IPAM service (AWS IPAM, or an equivalent third-party or homegrown tool) owns the top-level supernet and delegates each Region's /12 as an IPAM pool that only a specific account or automation role can draw from. Within a Region, a second-level pool per environment or business unit can further subdivide the /20 allocations if useful, but the discipline that matters most is that no human ever types a CIDR range by hand when creating a new VPC; the range comes from the pool automatically.
Automated guardrails against collisions. Wire VPC creation through infrastructure as code (a Terraform module or a CloudFormation/Service Catalog product) that calls the IPAM API to request the next available /20 from the correct Region's pool, rather than accepting an arbitrary CIDR input from whoever is provisioning the VPC. Back this with a policy check (an AWS Config rule, or a pre-merge check in the IaC pipeline) that rejects any VPC creation request specifying a CIDR outside the IPAM-managed range entirely, closing the loophole of someone bypassing the module and hand-typing a conflicting block.
Worked example
Region 1 (us-east-1, say) is assigned 10.0.0.0/12 from the pool of 16. Within it, the first three VPCs created via the IPAM-backed module receive 10.0.0.0/20, 10.0.16.0/20, and 10.0.32.0/20, in order, with the IPAM service tracking that these three are consumed and the remaining 253 blocks in that Region's pool are free. A team in a second Region (eu-west-1) independently provisions VPCs from their own 10.16.0.0/12 pool at the same time; because the two Regions draw from disjoint /12 blocks, there is no possibility of collision even though both teams are provisioning concurrently and neither is aware of the other's activity, which is precisely the property a manual spreadsheet cannot guarantee once more than a handful of teams are provisioning independently.
Trade-offs and pitfalls
Fixed-size blocks mean some allocations will be oversized for what a given VPC actually needs (a /20 for a tiny two-instance VPC wastes most of its 4,096 addresses), but the alternative, right-sizing each allocation individually, reintroduces exactly the manual bookkeeping and collision risk this design exists to eliminate; the wasted address space is a deliberate, acceptable cost given how much private IPv4 space a /8 actually provides. A second real trap: retrofitting this scheme onto an existing estate that already has ad hoc, overlapping CIDR ranges is much harder than designing it up front, because existing VPCs can't be renumbered without significant migration work; the guardrails described here are most valuable when established before the estate grows, not after.
For workloads that access managed cloud services (S3, Storage Accounts, object stores), compare using service endpoints (VPC endpoints / PrivateLink), NAT gateways, and proxy appliances. Discuss trade-offs in security (private backbone vs internet egress), cost, performance, and operational complexity.
Sample Answer
Direct answer
For workloads reaching managed cloud services like object storage, the fundamental question is why route that traffic out to the public internet and back at all, when the service and the workload both live inside the same provider's network. A service endpoint (VPC endpoint or PrivateLink) is the right default because it keeps traffic entirely on the provider's private backbone, is cheaper than routing that same traffic through a NAT gateway, and removes the public internet as a path entirely rather than just hiding behind it. A NAT gateway is the fallback for reaching genuinely external destinations that have no endpoint equivalent, and a proxy appliance is a deliberate, narrower choice reserved for cases needing content inspection, centralized egress filtering, or non-cloud-native destinations that neither of the other two options address.
Structured elaboration
| Dimension | Service endpoint (VPC endpoint / PrivateLink) | NAT gateway | Proxy appliance |
|---|---|---|---|
| Path | Stays entirely on the provider's private backbone; never touches the public internet | Reaches the public internet via an internet gateway; the destination happens to be a managed service, but the path is indistinguishable from reaching any other internet endpoint | Depends on the appliance's own configuration; typically forwards to the internet like a NAT gateway would, but with an inspection or policy step in between |
| Security | Strongest: no public-internet exposure for this traffic at all, and access can be scoped with an endpoint policy plus the target's own resource policy | Weaker: the traffic leaves the provider's network and is only as safe as transport-layer encryption (TLS) makes it over the public path; the source is also only as hidden as the NAT gateway's shared public IP makes it | Depends entirely on the appliance's own security posture and configuration; adds a single choke point that is valuable for inspection but is also now a resource you must secure and keep available |
| Cost | Free for Gateway Endpoints (S3, DynamoDB); a modest per-Availability-Zone (AZ)-hour plus per-gigabyte charge for Interface Endpoints, generally cheaper than NAT gateway's own per-gigabyte data-processing charge for equivalent traffic | Per-hour charge plus a per-gigabyte data-processing charge on top of standard data-transfer rates | Instance or appliance licensing cost, plus the operational cost of running and scaling it yourself, on top of whatever data-transfer charges the underlying path already carries |
| Performance | Generally the lowest latency and most consistent, since it never leaves the provider's backbone | Subject to standard internet-path characteristics once traffic leaves the gateway | Adds appliance processing latency, which can be substantial if the appliance is doing deep content inspection |
| Operational complexity | Low: create the endpoint, update the route table or enable private DNS, done | Low: a managed, largely hands-off service | Highest: you own the appliance's capacity planning, patching, high availability, and policy configuration |
| Best fit | The default for any same-provider managed service that offers an endpoint | Genuinely external destinations (a third-party API, a public package registry) with no endpoint equivalent | Regulatory or security requirements for content inspection, centralized logging of all egress, or destinations an endpoint cannot reach |
Worked example
A company's application in a private subnet needs to reach three different destinations: an S3 bucket for object storage, a third-party payment processor's public API, and, per a compliance requirement, all outbound traffic must be logged and filtered for known-malicious domains before it leaves the network. The S3 traffic goes through a Gateway Endpoint: free, private, and simple. The payment processor's API, being a genuinely external destination with no endpoint equivalent, has no choice but to route through the NAT gateway to reach the public internet, since a service endpoint cannot exist for infrastructure the company doesn't control an endpoint into. The compliance requirement for domain-level outbound filtering and logging cannot be satisfied by either the endpoint (which does not do content inspection) or the NAT gateway alone (which does address translation, not policy filtering), so a proxy appliance is inserted specifically for that requirement, positioned to see the NAT-gateway-bound traffic (the payment API call and any other genuinely external destinations) before it leaves the network, while S3 traffic continues to bypass it entirely over the private endpoint path, since a domain-filtering security control does not meaningfully apply to traffic that never touches the public internet or an external domain in the first place.
Trade-offs and pitfalls
The most common mistake is routing everything, including traffic to same-provider managed services with a perfectly good endpoint available, through a NAT gateway or a proxy appliance by default, simply because that was the original design before endpoints were added to the environment; this is pure unforced cost and exposure, since the traffic gains nothing from taking the internet-facing path and loses the endpoint's cost and privacy benefits. A second pitfall is inserting a proxy appliance for all egress traffic, including traffic to endpoints, without a specific requirement driving it, which adds appliance latency and a new capacity-planning burden to traffic that did not need inspection in the first place. Finally, when a genuine content-inspection requirement does exist, make sure it is scoped to the traffic that actually needs to be inspected (traffic actually leaving the network to a genuinely external destination), rather than applied uniformly in a way that either misses traffic that should be inspected (if placed incorrectly relative to the NAT gateway) or needlessly inspects traffic that never leaves the provider's network at all.
Design an outbound egress strategy for thousands of EC2 instances that will make a large number of simultaneous outbound connections creating high SNAT demand. Discuss NAT Gateway scaling limits, ephemeral port exhaustion, alternatives such as multiple NAT Gateways per AZ, proxying, autoscaling NAT instances, and monitoring approaches to detect and mitigate port exhaustion.
Sample Answer
Direct answer
The failure you're designing against is source port exhaustion, not raw bandwidth: a NAT (Network Address Translation) gateway multiplexes every outbound connection from a subnet through a small number of its own IP addresses, and each address can only track a limited number of simultaneous connections per unique destination. At thousands of instances all calling out to the same handful of destinations, that per-destination ceiling, not total throughput, is what you hit first, so the fix is to spread the load across more NAT capacity and reduce how many connections you actually need, not to make any single NAT gateway "bigger."
Structured elaboration
The actual limit. A NAT gateway supports up to 55,000 simultaneous connections to each unique destination, where "unique destination" is defined by destination IP, destination port, and protocol together; this ceiling is per NAT gateway IP address, and you can add secondary private IP addresses to a NAT gateway (up to a documented per-gateway maximum) with each additional address independently capable of another 55,000 connections to the same destination, giving you a mechanical way to raise the per-destination ceiling for a single NAT gateway without needing a second one. Beyond that, port exhaustion for a specific destination looks exactly like intermittent, hard-to-reproduce connection failures under load, not a clean error, which is what makes it painful to diagnose the first time a team hits it.
Mitigation options, roughly in order of how much they help versus how much they cost operationally.
- Multiple NAT gateways per Availability Zone (AZ), splitting the client fleet across them. Route different subnets (each holding a slice of the instance fleet) to different NAT gateways in the same AZ, so no single gateway carries the full connection count to a hot destination. This is the most direct fix for the specific "too many simultaneous connections to one destination" symptom.
- Add secondary IP addresses to existing NAT gateways. Mechanically multiplies the per-gateway ceiling to a hot destination without adding new gateways or changing routing, at the cost of a slightly more complex NAT gateway configuration to track.
- A proxying or connection-pooling layer in front of the hot destination. If the "hot destination" is a small number of external services being called extremely frequently, an internal HTTP proxy or a connection-pooling sidecar that reuses a smaller number of long-lived connections instead of opening a new one per request reduces the connection count itself, which is the more durable fix when the traffic pattern allows it (works well for HTTP-style request/response traffic, less well for protocols that need one connection per logical session).
- Autoscaling NAT instances instead of managed NAT gateways. Trades the managed gateway's simplicity and 55,000-per-destination ceiling for a self-managed EC2 (Elastic Compute Cloud) fleet you scale and patch yourself, which can be tuned at the OS (operating system) level (larger ephemeral port ranges, tuned connection tracking tables) but reintroduces operational burden the managed NAT gateway exists specifically to remove; reach for this only when the managed limits are a genuine, measured blocker and the proxying/multi-gateway options don't fit the traffic pattern.
Monitoring to detect and mitigate before it becomes an incident. NAT gateway CloudWatch metrics include connection-related counters; watching for a rising trend toward the per-destination ceiling on any single gateway, and watching the IdleTimeoutCount metric (connections dropped for staying idle past the gateway's timeout, which frees capacity) gives an early warning before requests actually start failing. Combine this with VPC Flow Logs filtered to the NAT gateway's ENI (elastic network interface) to identify which specific destination is driving the connection count, since the fix (more gateways, a proxy, or secondary IPs) depends on knowing whether it's one hot destination or broadly distributed load.
Worked example
A fleet of 3,000 instances across one AZ all call the same external payments API. If even 5% of the fleet (150 instances) each maintains just 400 simultaneous connections to that one API endpoint at peak, that's 150×400=60,000 simultaneous connections to a single destination, already past the 55,000 ceiling for one NAT gateway IP address. Splitting those 150 instances' subnet across two NAT gateways (or adding one secondary IP address to the existing gateway, since 55,000×2=110,000 comfortably covers the observed 60,000) resolves the immediate ceiling; introducing a connection-pooling proxy in front of the payments API so those 150 instances funnel through, say, 20 long-lived pooled connections instead of 400 each removes the pressure at the source rather than just adding more NAT capacity to absorb it.
Trade-offs and pitfalls
Adding more NAT gateways or secondary IPs is the fast fix but doesn't reduce the underlying connection churn, it just raises the ceiling the churn bumps against, so it's a reasonable stopgap while a proxy or pooling solution is built, not a permanent substitute for one if the traffic pattern keeps growing. The other common trap is diagnosing this as a bandwidth or throughput problem (since "NAT gateway" sounds like a bandwidth device) and scaling in the wrong dimension entirely; the symptom (intermittent failures specifically to one or a few destinations, not overall slowness) is the tell that this is a connection-count ceiling, not a bandwidth ceiling.
Your organization needs low-latency private connectivity from on-prem to cloud with automatic failover to the internet. Design a hybrid connectivity solution using Direct Connect (or ExpressRoute/Cloud Interconnect) as primary and an IPsec VPN as backup. Address BGP configuration, route prioritization, MTU adjustments, redundancy for device and physical paths, testing failover, and cost tradeoffs.
Sample Answer
Direct answer
The design is a dedicated private circuit (Direct Connect, ExpressRoute, or Cloud Interconnect) carrying the primary path, an IPsec (a protocol suite that encrypts traffic between two network endpoints) Site-to-Site VPN carrying a standby path, both terminating on the same Virtual Private Gateway or Transit Gateway (a managed hub that routes traffic between many attached networks) so both paths propagate routes into the same route table, and Border Gateway Protocol (BGP) configured so the dedicated circuit is always preferred while it is healthy and traffic fails over to the VPN automatically, without a human in the loop, the moment it is not. Getting this right is mostly about three things: making the BGP preference explicit rather than accidental, building physical and device redundancy into the dedicated circuit itself (a single circuit is a single point of failure regardless of what backs it up), and proving the failover actually works before you need it, not after.
Structured elaboration
BGP configuration and route prioritization. Both the dedicated circuit and the VPN peer with the cloud side over BGP and advertise the same on-premises routes. Left unconfigured, BGP will pick a path using its own default best-path rules, which is not something you want to leave to chance for something as consequential as which link carries production traffic. Make the preference explicit with either of two standard levers: AS-path prepending on the VPN side (artificially lengthening the advertised path so BGP's shortest-AS-path rule favors the dedicated circuit), or a local-preference value set higher for routes learned over the dedicated circuit (local preference is evaluated before AS-path length, so it is the more deterministic and commonly preferred lever where the platform supports setting it). Either way, verify the resulting preference by checking the route table's actual selected path, not just by assuming the configuration took effect.
MTU (maximum transmission unit) adjustments. The two paths do not share the same maximum packet size, which is a common source of application-layer symptoms (stalled large transfers, hung connections) that look nothing like a routing problem. A Direct Connect path commonly supports jumbo frames (up to roughly 9001 bytes on the virtual interface, and a lower MTU across a Transit Gateway attachment depending on the attachment type), while a standard IPsec VPN tunnel is capped much lower (roughly 1446 bytes), and IPsec's tunnel overhead means the true end-to-end payload capacity is smaller still. If applications on either end assume a single fixed MTU across both paths, failover from the dedicated circuit to the VPN will silently start dropping or fragmenting packets that fit comfortably over the dedicated path, so either configure Path MTU Discovery correctly end to end, or explicitly clamp the maximum segment size (MSS) at the lower value everywhere so it works identically on both paths.
Redundancy for device and physical paths. "Dedicated circuit as primary" is not resilient on its own if it is a single circuit, on a single device, into a single facility: any one of those three failing takes the primary path down entirely, VPN backup or not. The standard resilient design uses two physical connections, terminating on two separate routers, ideally into two separate colocation facilities, so no single piece of physical infrastructure failing removes the entire dedicated path at once. The VPN backup itself should also not be a single point of failure: a standard VPN connection already provisions two tunnels to two separate endpoints for exactly this reason, and both should be live and tested, not just the first one.
Testing failover. Never assume a failover path works because it was configured; prove it on a schedule. The standard method is a controlled failure injection: administratively withdraw the dedicated circuit's BGP advertisement (or physically disable one connection in a maintenance window) and confirm traffic actually shifts to the VPN within an acceptable convergence time, application sessions recover, and then confirm traffic shifts back cleanly when the primary is restored, checking for any asymmetric-routing or stale-route artifacts left over from the test.
Cost trade-offs. The dedicated circuit carries a recurring port-hour and cross-connect cost regardless of how much of its capacity is used, plus the physical provisioning lead time (commonly weeks) to establish it, while the VPN backup is comparatively cheap and fast to stand up but cannot be assumed to carry full production load indefinitely; size its bandwidth for how long you are willing to run in a degraded state, not for a permanent steady state.
Worked example
SLA (service-level agreement) and throughput target: 10 Gbps sustained with a sub-100-millisecond round-trip requirement. A single standard VPN tunnel tops out around 1.25 Gbps of throughput, so the VPN backup alone cannot carry 10 Gbps; it exists to keep the business running at reduced capacity during a Direct Connect outage, not to match it. The dedicated circuit is provisioned to comfortably clear 10 Gbps with headroom (for example, a 10 Gbps port with monitoring alerting well before sustained utilization approaches that ceiling), and because Direct Connect traffic stays on the provider's backbone rather than crossing the public internet, its round-trip latency is both lower and, critically, far more consistent than an internet-routed VPN path, which is what actually delivers the sub-100-millisecond requirement; the VPN path's latency is not something you can guarantee, since it depends on the public internet's path at any given moment.
Route preference toward the dedicated circuit, concretely. On the VPN-side router, the on-premises routes advertised toward the cloud are prepended with extra AS-path entries so they look like a longer, less preferable path than the same routes advertised over Direct Connect; on the cloud side, if the platform's BGP implementation supports it, local preference is set higher for routes learned via the Direct Connect virtual interface than for the same prefixes learned via the VPN. Both changes push BGP's path-selection algorithm toward the same conclusion (prefer Direct Connect) through two independent, redundant levers, so a partial misconfiguration of one does not necessarily undo the intended preference.
graph LR
ONPREM[On-premises router - BGP] -->|Primary: Direct Connect, 10G port, jumbo MTU| DX[Direct Connect / virtual interface]
ONPREM -->|Backup: IPsec VPN, prepended AS-path| VPN[Site-to-Site VPN, 2 tunnels]
DX --> VGW[Virtual Private Gateway / Transit Gateway]
VPN --> VGW
VGW --> VPCNET[(VPC route table)]
Trade-offs and pitfalls
The most common failure is discovering the MTU mismatch in production during an actual failover, not during testing: an application that worked fine over the jumbo-frame-capable dedicated circuit starts silently truncating or stalling large transfers over the lower-MTU VPN path, right when the team is already dealing with a primary-path outage. A second pitfall is configuring BGP preference only on one side (say, prepending on the VPN router) and assuming that alone is deterministic; without checking the actual installed route on both ends, an asymmetric configuration can leave inbound and outbound traffic taking different paths, which complicates troubleshooting and can break stateful inspection devices in the path. Finally, teams sometimes test failover once, at initial setup, and never again: a later change to routing policy, a new route filter, or a provider-side change to the VPN endpoints can silently break the failover path while the primary continues working normally, so the failure goes unnoticed until the primary actually fails.
Unlock Full Question Bank
Get access to all 45 Cloud Networking and VPC Design interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.