AWS VPC Interview Questions
Reviewed by Mark Dickie · Last updated
15 questions on this page you can answer and see marked on the spot. Go to the first one
AWS VPC (Virtual Private Cloud) is a logically isolated section of the AWS cloud where you launch resources in a virtual network you define. For interviews, the core topics are subnet design (public vs private), route table logic, security groups versus NACLs, NAT gateway placement, and cross-network connectivity through peering or Transit Gateway. You should be able to trace a packet from an EC2 instance out to the internet and explain each hop, and you should know how CIDR block sizing constrains your subnet count and IP availability.
What does an AWS VPC interview test?
Interviewers want to see whether you can design a network topology and explain why each component is there. Expect questions about:
- Choosing CIDR blocks that avoid overlap with peered VPCs or on-premises networks
- Deciding when a subnet should be public (has a route to an internet gateway) versus private
- Placing a NAT gateway in a public subnet so private instances can reach the internet
- Configuring security groups (stateful, attached to ENIs) and NACLs (stateless, attached to subnets) to enforce traffic rules
- Explaining VPC peering limitations versus Transit Gateway for hub-and-spoke topologies
Security groups vs network ACLs
| Aspect | Security Group | Network ACL |
|---|---|---|
| Stateful? | Yes, return traffic is auto-allowed | No, inbound and outbound rules both required |
| Attached to | ENI (instance-level) | Subnet |
| Rule evaluation | All rules evaluated before decision | Rules evaluated in order, lowest number first |
| Allow rules only? | Yes, no deny rules supported | Both allow and deny rules |
| Default behavior | Deny all inbound, allow all outbound | VPC default ACL allows all traffic |
How do public and private subnets differ?
A subnet is public when its route table has a 0.0.0.0/0 entry pointing to an internet gateway (IGW). A private subnet has no such route. Instances in a private subnet can still reach the internet outbound if a route sends 0.0.0.0/0 traffic to a NAT gateway sitting in a public subnet, but inbound connections from the internet cannot reach them directly. The quiz below covers these distinctions along with peering, endpoints, and Transit Gateway scenarios drawn from real interview rounds.
Key facts
- Tarmac has 26 AWS interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 5,372 job postings asking for AWS in September 2026.
- Roles asking for AWS advertise a median base salary of US$172,500, across 1,891 job postings as of September 2026.
- Tarmac last reviewed these AWS interview questions on 13 October 2026.
At a glance
| Questions | 25 shown · 26 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | True / false, Short answer, Flashcard, Multiple answer, Multiple choice, Fill in the blank, Find the bug, Ordering |
What you'll review
- vpc
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
Every AWS Region already has a default VPC waiting for you, with a public subnet in each Availability Zone, an Internet Gateway attached, and instances you launch there getting a public IP automatically unless you opt out.#
Options
Show answer
True. Every AWS Region provisions a default VPC automatically (typically a 172.31.0.0/16 block) with one public subnet per Availability Zone, an Internet Gateway already attached, and a route table sending 0.0.0.0/0 to it. Each default subnet has MapPublicIpOnLaunch enabled, so launching an instance with no networking configuration gives it a public IP by default. That convenience is exactly why production workloads are usually placed into a custom VPC with deliberately private subnets instead.
True. Every Region starts with a default VPC (a /16, typically 172.31.0.0/16) with one public subnet per AZ, an Internet Gateway already attached, and a main route table sending 0.0.0.0/0 to it. Each default subnet has MapPublicIpOnLaunch enabled, so an instance launched with no networking configuration gets a public IP automatically — which is convenient for a quick test but is exactly why production workloads should be deliberately placed into a custom VPC with private subnets instead of relying on the default's wide-open convenience.
You have EC2 instances in a private subnet that need to download software updates from the internet over IPv4. Which AWS resource enables outbound internet access from that private subnet while preventing unsolicited inbound connections from the internet? Name the resource and where it is placed.#
Show answer
A NAT Gateway (or a NAT instance) placed in a public subnet, with a route in the private subnet's route table sending 0.0.0.0/0 to the NAT Gateway. Instances can initiate outbound connections, and the NAT device returns only the responses to those connections, so unsolicited inbound traffic from the internet is blocked.
A NAT Gateway is deployed in a public subnet and lets instances in a private subnet initiate outbound IPv4 connections to the internet (for example, to fetch patches) while blocking inbound connections that were not initiated from inside the VPC. The private subnet's route table needs a 0.0.0.0/0 route pointing to the NAT Gateway. An Internet Gateway alone attaches the VPC to the internet but does not translate private addresses, so private instances would lack a route for outbound traffic and could be reached directly if given public IPs. VPC Peering and Transit Gateway connect VPCs or networks to each other, not to the public internet.
True or false: A single AWS VPC can span multiple AWS regions.#
Options
Show answer
A single AWS VPC cannot span multiple AWS regions, because a VPC is a regional resource that exists in exactly one region. Its subnets can span multiple Availability Zones within that region. To connect workloads across regions, you create a VPC in each region and link them with VPC Peering, Transit Gateway, VPN, or Direct Connect.
The statement is false. A VPC is a regional resource that exists within exactly one AWS region and never crosses region boundaries. Subnets inside a VPC can span multiple Availability Zones in that same region. To connect workloads across regions, you create a separate VPC in each region and link them with VPC Peering, Transit Gateway, a VPN, or Direct Connect.
In AWS, VPC peering connections are non-transitive. Briefly explain what this means and why it makes a full-mesh peering topology impractical when connecting many VPCs.#
Show answer
Non-transitive means that if VPC A is peered with VPC B and VPC B is peered with VPC C, VPC A cannot route traffic to VPC C through VPC B. Each pair of VPCs that need to communicate requires its own direct peering connection. In a full-mesh topology of N VPCs, this means N*(N-1)/2 peering connections, which grows quadratically and quickly becomes unmanageable as the number of VPCs increases.
VPC peering in AWS is a point-to-point, non-transitive connection. Traffic cannot pass through an intermediate VPC to reach a third one, so every communicating pair needs a dedicated peering link. A full-mesh arrangement therefore requires N*(N-1)/2 peerings, which scales quadratically and becomes operationally unwieldy for large numbers of VPCs, making peering a poor choice for broad, many-to-many connectivity.
In AWS, at which infrastructure level is a VPC scoped: a single Availability Zone, a single Region, or the whole AWS global network? Name the level and briefly explain why.#
Show answer
A VPC is a regional resource scoped to one AWS Region, and it spans all Availability Zones in that Region. It is not tied to a single Availability Zone (subnets are what map to one AZ each), it does not extend across Regions, and it is not a global resource.
A VPC is a regional resource: when you create it you choose a Region, and it spans every Availability Zone in that Region. Subnets, not the VPC, are bound to individual Availability Zones, with each subnet living in exactly one AZ. A VPC does not extend across Regions, so the Region is the level at which it is scoped.
What is an Amazon VPC, and what are its main building blocks?#
Show answer
A Virtual Private Cloud is a logically isolated virtual network you define inside a Region, with an IP address range you choose (a CIDR block). You carve it into subnets, each living in a single Availability Zone; a public subnet routes to the internet via an Internet Gateway, a private subnet reaches the internet only outbound through a NAT Gateway. Route tables control where traffic goes, and security groups (stateful, instance-level) plus network ACLs (stateless, subnet-level) control what traffic is allowed. It's the network boundary your EC2 instances, RDS databases, and other resources run inside.
A VPC is the foundational networking layer almost every other AWS resource sits in. The pieces that matter in interviews: it's Region-scoped with subnets pinned to one AZ each, public vs private subnets are defined by their route to an Internet Gateway vs a NAT Gateway, and security groups (stateful) vs NACLs (stateless) are the two filtering layers. Being fuzzy on subnets-are-AZ-scoped or on the IGW-vs-NAT distinction is a common tell of someone who hasn't actually built a network.
Select every true statement about how subnet CIDR blocks work inside an AWS VPC.#
Options
Pick every one that applies.
Show answer
- AWS reserves 5 IP addresses in every subnet's CIDR block (the network address, the VPC router, DNS, a reserved-for-future-use address, and the broadcast address), so a /24 subnet has 251 usable addresses, not 256
- A subnet's CIDR block must be a subset of its VPC's CIDR block and cannot overlap with any other subnet in that VPC
Both real constraints show up constantly in capacity planning: every subnet loses 5 addresses to AWS reservations regardless of size, so a /28 (16 addresses) nets only 11 usable — small enough to bite teams who size subnets too tightly. And subnet CIDRs must nest inside the VPC's CIDR with zero overlap between sibling subnets, since a VPC's route table can't disambiguate an address that two subnets both claim. Neither the claim that a subnet's CIDR block can be widened or narrowed after creation nor the claim that DNS resolution for instances is a per-subnet setting inherited from the subnet's Availability Zone is real: a subnet's CIDR block is fixed at creation with no resize path at all (not even a conditional one), and DNS resolution (enableDnsSupport/enableDnsHostnames) is configured at the VPC level, not derived per-subnet from its AZ.
When do you outgrow VPC peering and reach for a Transit Gateway instead?#
Show answer
VPC peering connects exactly two VPCs and is non-transitive — it doesn't chain, so N VPCs that all need to talk to each other require an N×(N-1)/2 mesh of individual peering connections, each with its own route-table entries on both sides. A Transit Gateway replaces that mesh with a single Regional hub: every VPC (and VPN or Direct Connect link) attaches to it once, and it routes between all attachments centrally, so adding a new VPC means one new attachment instead of one new connection per existing VPC. The trade-off is cost — a Transit Gateway bills per attachment-hour plus per-GB processed, where peering itself is free (you only pay standard data transfer) — so peering still wins for a handful of VPCs, and Transit Gateway wins once the mesh gets unmanageable.
The scaling math is the interview point: peering is O(n²) connections as VPC count grows, and each one needs manual route-table wiring on both sides — a real operational burden past a handful of VPCs. Transit Gateway turns that into O(n) attachments with centralized route tables (including the ability to segment attachments into different routing domains). Knowing this trade-off, rather than defaulting to 'just peer everything,' is what separates someone who has actually run a multi-VPC estate from someone reciting definitions.
In an Amazon VPC, which statement about subnets and Availability Zones (AZs) is correct?#
Options
Show answer
In an Amazon VPC, each subnet resides in exactly one Availability Zone and cannot span multiple AZs. Every instance launched into that subnet runs in the same AZ. Subnets are not created automatically when a VPC is made, so you specify the AZ for each subnet yourself.
In the Amazon VPC model, every subnet is associated with exactly one Availability Zone at creation time and cannot span more than one. This is a platform-level constraint, so instances launched into a subnet always run in that subnet's AZ. The other statements are false: a subnet cannot span multiple AZs; creating a VPC does not auto-create subnets, so each subnet must be explicitly created in a chosen AZ; and an AZ can hold many subnets within the same VPC (for example, one public and one private).
In Amazon VPC, a _____ is the resource that controls which network destinations traffic from a subnet is directed to (e.g., sending 0.0.0.0/0 traffic to an Internet Gateway).#
Show answer
In Amazon VPC, a route table is the resource that controls which network destinations traffic from a subnet is directed to (e.g., sending 0.0.0.0/0 traffic to an Internet Gateway).
A route table is the VPC resource that maps destination CIDR blocks to targets such as an Internet Gateway, NAT Gateway, or VPC peering connection. The default route 0.0.0.0/0 pointed at an Internet Gateway is what makes a subnet public. Network ACLs filter traffic but do not route it, security groups are stateful instance-level firewalls, and the Internet Gateway is a target rather than the resource that holds the routes.
You create a new custom VPC in AWS using the VPC wizard (NOT the default VPC that AWS provisions per region). List the three resources that AWS automatically creates and associates for this custom VPC at creation time.#
Show answer
A default security group, a default network ACL, and a main route table.
When you create a custom VPC in AWS, exactly three resources are automatically created and associated at creation time: a default security group (with an allow-all rule for instances in the same group), a default network ACL (allowing all inbound and outbound traffic), and a main route table (containing only the local route for the VPC CIDR). AWS does not auto-provision subnets, an internet gateway, or a NAT gateway for a custom VPC; those (one subnet per AZ and an attached internet gateway) are only provisioned for the AWS-managed default VPC that comes with each region. Because all three of these resources are always created together, the question asks for the full set rather than singling one out.
You're provisioning a new VPC for a platform that will eventually need dozens of subnets spread across several Availability Zones, plus peering to other VPCs later. What's the main risk of picking a small primary CIDR block like /24 up front?#
Options
Show answer
A small primary CIDR like /24 gives the whole VPC only 256 addresses to divide across every subnet and Availability Zone, and AWS does not allow resizing a VPC's primary CIDR block after creation. Running out of space later means creating a new VPC or adding a secondary CIDR block, which then has to avoid overlapping every VPC it might ever peer with. Because growing into unused address space costs nothing but shrinking isn't possible, the standard practice is to size the primary CIDR generously (often /16) even for a service that starts small.
AWS lets you pick the VPC's primary IPv4 CIDR anywhere from /16 down to /28, but once set, that primary block's size can't be changed — you can only add non-overlapping secondary CIDR blocks alongside it, and any block you add has to avoid every CIDR you might peer with later. A /24 (256 addresses total) sounds like plenty until you subtract AWS's 5 reserved addresses per subnet and multiply by AZ count and subnet tiers (public/private/data); teams that undersize routinely paint themselves into a corner. The standard advice is to start generous (often /16) even for a small footprint, because growing into unused space is free and shrinking isn't possible. The other options are all false statements about how VPC CIDR sizing actually works.
VPC A is peered with VPC B, and VPC B is separately peered with VPC C. Can an instance in VPC A reach an instance in VPC C through that setup?#
Options
Show answer
No — VPC peering connections are non-transitive. Traffic can't route from VPC A through VPC B to reach VPC C, even if every route table is configured to try; AWS's peering implementation only ever routes between the two VPCs in a given peering connection, never across a chain. Reaching C from A requires either its own direct A-to-C peering connection or replacing the growing peering mesh with a Transit Gateway, which acts as a single Regional router every VPC attaches to once.
VPC peering is explicitly non-transitive by design: it connects exactly the two VPCs in the peering relationship, and VPC B will not forward traffic between A and C even with route tables configured to try it — AWS's peering implementation simply doesn't route across a 'hop.' To let A and C talk, you either add a direct A↔C peering connection (and at n VPCs, that's an O(n²) mesh) or replace the mesh with a Transit Gateway, which acts as a Regional hub-and-spoke router that every VPC attaches to once. Identical CIDR blocks would actually block peering, not enable it — overlapping CIDRs are rejected. The claim that an account can only maintain one active peering connection at a time is false.
Select every statement that correctly distinguishes a managed NAT Gateway from a self-managed NAT instance (an EC2 instance running as a NAT with source/destination checks disabled).#
Options
Pick every one that applies.
Show answer
- A NAT Gateway is a fully managed AWS service with no OS to patch, scaling bandwidth automatically up to 100 Gbps, while a NAT instance's throughput is capped by whatever EC2 instance type it runs on
- A NAT instance can double as a bastion host or run other software on the same box, which a NAT Gateway can't since it exposes no OS to log into
NAT Gateway and NAT instance solve the same problem — outbound-only internet access for private subnets — with opposite operational trade-offs. NAT Gateway is a managed service: no patching, no instance sizing, automatic scaling to 100 Gbps, and an SLA, but it's a single-purpose black box. A NAT instance is 'just an EC2 box' with IP forwarding and disabled source/dest checks, so it can be repurposed (bastion, monitoring agent) but you own its patching, sizing, and HA. The claims that a NAT Gateway can route directly between two private subnets and that a security group attaches directly to it are both false: a NAT Gateway must live in a public subnet with an Elastic IP to reach the internet at all, and it has no concept of a security group — traffic to/from it is filtered by the subnet's network ACL, not an attached SG (that's a NAT instance's model, since it's a real EC2 instance).
Traffic from a private subnet to an S3 bucket routed through a gateway VPC endpoint never passes through an Internet Gateway or a NAT Gateway, and never leaves the AWS network.#
Options
Show answer
True. An S3 gateway VPC endpoint adds a route-table entry matching S3's managed prefix list and sends the traffic directly to S3 over AWS's internal network, with no Internet Gateway or NAT Gateway in the path and no public IP involved. That keeps the traffic off the public internet entirely and avoids the NAT Gateway's per-GB processing charge that the same traffic would otherwise incur.
True. A gateway endpoint adds an entry to the subnet's route table that matches S3's (or DynamoDB's) managed prefix list and routes it directly to the service over AWS's internal network — no Internet Gateway, no NAT Gateway, and no public IP involved at any point. That's both a security win (the traffic is never exposed to the public internet) and a cost win (S3 gateway endpoints carry no hourly or per-GB charge, unlike routing the same traffic out through a NAT Gateway, which bills per GB processed).
EC2 instances in a private subnet can't reach the internet at all — not even yum update — even though a NAT Gateway already exists in the VPC's public subnet. Here's the private subnet's route table. What's missing?#
Destination Target
10.0.0.0/16 localOptions
Show answer
There's no 0.0.0.0/0 route pointing at the NAT Gateway (nat-xxxx) — without it, only traffic addressed inside the VPC's own CIDR (10.0.0.0/16) is routed anywhere, and everything else is dropped
The route table shown has only the automatic local route for the VPC's own CIDR — there is no default route sending everything else (0.0.0.0/0) to the NAT Gateway, so any request to an address outside the VPC has nowhere to go and is dropped. The fix is adding 0.0.0.0/0 → nat-xxxx. Private subnets should never get their own Internet Gateway — that's what would make them public; a NAT Gateway isn't a device you attach a separate route table to, the route lives on the subnet's table; and the entire point of routing through NAT is that private instances stay private, so they explicitly don't need public IPs — the NAT Gateway's own Elastic IP is what's public.
A teammate asks you to explain the difference between a security group and a network ACL in a VPC. Give the distinction along at least two dimensions.#
Show answer
They filter traffic at different layers and with different semantics. A security group is attached to individual instances/ENIs, is stateful (return traffic for an allowed connection is permitted automatically, no matching rule needed), and supports Allow rules only — there's no explicit Deny, so it's default-deny with rules that only ever open things up. A network ACL is attached to a subnet and applies to every instance in it, is stateless (inbound and outbound must each be explicitly allowed, including for return traffic on ephemeral ports), and supports both Allow and explicit Deny rules, evaluated in ascending rule-number order with the first match winning. In practice, security groups do most of the day-to-day filtering; NACLs are mainly reached for when you need a subnet-wide explicit block (e.g. blacklisting a malicious CIDR) that a security group can't express.
The interview signal here is whether the candidate has the two axes straight rather than treating both as 'the same thing at a different layer.' Security groups: instance-level, stateful, allow-only. NACLs: subnet-level, stateless, allow-and-deny, order-matters. A candidate who can also explain why — stateful means connection tracking handles return traffic automatically, stateless means it doesn't and both directions need explicit rules — is showing they've actually debugged connectivity with these, not just memorized a comparison table.
An EC2 instance in a private subnet calls an external API at a public IP. A NAT Gateway sits in the VPC's public subnet with an Elastic IP. Order the steps the outbound packet takes to reach the internet.#
Put these in order
Show answer
An outbound packet from a private-subnet instance takes a fixed five-step path. First the instance sends a packet whose destination falls outside the VPC's local CIDR. The private subnet's route table matches its 0.0.0.0/0 route and forwards it to the NAT Gateway. The NAT Gateway rewrites the packet's source address to its own private IP address. The public subnet's route table then forwards that already-NAT'd traffic to the Internet Gateway. Finally the Internet Gateway translates the NAT Gateway's private IP to its Elastic IP and puts the packet on the public internet. The NAT Gateway rewrites to its private IP; the Internet Gateway maps that to the Elastic IP for the actual handoff to the internet — they are two distinct hops, not one.
Outbound NAT is two separate routing hops plus one address rewrite, and mixing up the order is the usual source of confusion. First the private subnet's own route table decides the packet isn't local traffic and sends it to the NAT Gateway (this is what makes it work from a private subnet with no public IP of its own). The NAT Gateway then source-NATs the packet to its own private IP before it ever reaches the Internet Gateway. Only then does the public subnet's route table forward that already-NAT'd traffic to the Internet Gateway, which translates the NAT Gateway's private IP to its Elastic IP — a private IP isn't routable on the public internet, so this final hop is what actually gets the packet onto it. The NAT Gateway rewrites to its private IP; the Internet Gateway maps that private IP to the Elastic IP — conflating the two is why people misdiagnose which hop is failing when outbound connectivity breaks.
Which statement correctly describes a distinction between Security Groups and Network ACLs (NACLs) in an AWS VPC?#
Options
Show answer
Security Groups are stateful, so return traffic for an allowed inbound request is permitted automatically. Network ACLs are stateless, so each direction needs its own explicit allow rule, including return traffic. This difference is a core distinction between the two VPC filtering mechanisms.
Security Groups are stateful: when an inbound request is allowed, the matching response traffic is automatically permitted without an outbound rule for it. Network ACLs are stateless, so each direction needs its own explicit allow rule, including the return traffic. The other statements invert the real behavior: NACLs are the ones that evaluate numbered rules in order and stop at the first match, and Security Groups are the ones that support only allow rules, whereas NACLs support both allow and deny.
Private subnets in three Availability Zones all route their outbound internet traffic through a single NAT Gateway that lives in just one of those AZs. What's the operational risk, and what's the standard fix?#
Options
Show answer
A NAT Gateway is scoped to the single Availability Zone it's created in, not Regional. Routing every private subnet through one NAT Gateway means an outage in that one AZ takes down outbound internet access for every subnet using it, and traffic from other AZs pays cross-AZ data transfer charges just to reach it. The standard fix is one NAT Gateway per AZ, with each AZ's private subnets routed to the NAT Gateway in their own AZ, so a single AZ failure only affects that AZ's own outbound path.
A NAT Gateway is an AZ-scoped resource, not a Regional one — it lives in one specific public subnet in one AZ. If that AZ goes down, or even just has degraded networking, every private subnet pointed at it loses outbound internet access simultaneously, and it also means every other AZ's outbound traffic is crossing AZ boundaries (and paying for it) to reach the single NAT Gateway. The standard highly-available pattern is one NAT Gateway per AZ, each in that AZ's public subnet, with each AZ's private-subnet route tables pointing at the NAT Gateway local to them — so an AZ failure only takes down that AZ's own outbound path, and traffic never has to hop AZs. An Internet Gateway is a separate, Regional resource that serves public subnets directly; it isn't a NAT substitute or a NAT failover mechanism.
A network ACL has rule #100 that denies TCP 3389 from 0.0.0.0/0, and rule #200 that allows TCP 3389 from a specific admin CIDR. A connection attempt from that admin CIDR arrives. What happens, and why?#
Options
Show answer
The connection is denied. Network ACL rules are evaluated in ascending rule-number order, and the first rule that matches wins — evaluation stops there rather than continuing to look for a better or more specific match. Rule #100's broad 0.0.0.0/0 deny matches the admin CIDR too (it's a superset), so it wins before rule #200's narrower allow is ever reached. Fixing this means renumbering so the specific Allow has a lower rule number than the broad Deny; NACLs have no concept of a later, more specific rule overriding an earlier one.
Network ACLs are stateless and rule-ordered: AWS evaluates rules starting from the lowest number, and the first rule that matches the traffic decides the outcome — evaluation stops there. It does not scan for the most specific match, and it does not let a later Allow override an earlier Deny the way people sometimes assume from security-group behavior (which has no concept of rule order or explicit deny at all). Here, rule #100's 0.0.0.0/0 deny matches the admin CIDR too, since it's a superset, so it wins outright and rule #200 never gets evaluated. The fix is renumbering so the narrower Allow has a lower number than the broad Deny — rule ordering in NACLs is exactly the kind of detail that silently breaks 'correct-looking' configs.
You want private, non-internet access from a VPC to both S3 and Secrets Manager, without traffic ever crossing an Internet Gateway or NAT Gateway. Why can't you satisfy both with the same VPC endpoint type?#
Options
Show answer
S3 and DynamoDB are the only two services with gateway endpoints — a free route-table entry pointing traffic at a managed prefix list. Everything else that supports private VPC connectivity, including Secrets Manager, uses an interface endpoint instead: an Elastic Network Interface with a private IP inside your subnet, fronted by AWS PrivateLink and billed hourly plus per-GB. Because the two mechanisms serve different, non-overlapping sets of services, reaching both S3 and Secrets Manager privately requires provisioning one endpoint of each type rather than a single endpoint covering both.
AWS has two distinct VPC endpoint mechanisms and they aren't interchangeable. A gateway endpoint is just a target you add to a route table — traffic matches a managed prefix list and gets routed to the service, at no hourly or per-GB cost — but it's only available for S3 and DynamoDB. Everything else that supports private connectivity (Secrets Manager, KMS, SNS, SQS, EC2, most others) does it through an interface endpoint: an Elastic Network Interface with a private IP dropped into your subnet, fronted by AWS PrivateLink, billed per-hour-per-AZ plus per-GB processed. So reaching both S3 and Secrets Manager privately genuinely requires provisioning one of each type — there's no single endpoint that covers everything.
Private-subnet instances currently reach S3 by routing outbound through a NAT Gateway to the public internet. Why would you add an S3 gateway VPC endpoint instead, and what actually changes?#
Show answer
A gateway endpoint adds a route-table entry that sends S3-bound traffic directly to S3 over AWS's internal network instead of out through the NAT Gateway to the public internet. Three things change: cost (NAT Gateway bills per-GB processed for all that S3 traffic; a gateway endpoint has no hourly or per-GB charge at all), security (the traffic never touches the public internet or needs a route through an Internet Gateway, so there's no exposure even in principle), and it removes a dependency — S3 access keeps working even if the NAT Gateway is degraded or removed. Mechanically, you create the endpoint, attach it to the subnet's route table, and AWS adds a route matching S3's managed prefix list that takes priority over the 0.0.0.0/0 NAT route for S3's IP ranges; no ENI, no security group, no code changes needed.
This tests whether someone understands gateway endpoints as an architectural and cost decision, not just a checkbox. The concrete wins to listen for: no NAT Gateway per-GB data-processing charge for that traffic, no path through the public internet at all (stronger security posture, not just 'private-looking'), and the mechanism — a route-table entry matching S3's prefix list — rather than vague 'it makes it private' hand-waving. A strong answer also notices this decouples S3 reachability from the NAT Gateway's own availability.
A VPC peering connection between VPC A (10.0.0.0/16) and VPC B (10.1.0.0/16) shows as active. Instances in VPC A can now reach instances in VPC B, but instances in VPC B still can't reach anything in VPC A. Here's VPC B's route table. What's missing?#
Destination Target
10.1.0.0/16 local
0.0.0.0/0 igw-0123abcdOptions
Show answer
VPC B's route table has no route sending traffic for VPC A's CIDR (10.0.0.0/16) to the peering connection (pcx-xxxx) — an active peering connection only makes routing possible, it doesn't add the routes; each side's route table needs its own explicit route added, and it's easy to add it on one side and forget the other
This is the single most common peering gotcha: an active peering connection is necessary but not sufficient — it just makes the path available, it does not populate anyone's route table. Each side has to separately add a route sending the other VPC's CIDR to the peering connection ID. VPC A clearly has its route to B (traffic flows A→B), but VPC B's table above only has its own local CIDR and a default route to an Internet Gateway — no route to 10.0.0.0/16 at all, so return or A-bound traffic has nowhere to go and connectivity is one-directional. Peering acceptance happens once, not per-direction. Peering traffic is direct VPC-to-VPC and never touches a NAT Gateway. Security groups can reference the peer's CIDR block just fine for peered traffic — no special peering-connection-ID syntax is required.
You have an AWS Transit Gateway (TGW) in us-east-1 with two VPC attachments: VPC A (CIDR 10.0.0.0/16) and VPC B (CIDR 10.1.0.0/16). The VPC A subnet route table contains a route for 10.1.0.0/16 targeting the TGW attachment, and the VPC B subnet route table contains a route for 10.0.0.0/16 targeting the TGW attachment. However, the TGW route table associated with both attachments has NO entries for either VPC's CIDR. Route propagation is disabled on the TGW route table, and no static routes were added. Security groups and NACLs on both sides allow all traffic. An EC2 instance in VPC A sends a TCP SYN to an instance in VPC B on port 443. What is the outcome, and why?#
Show answer
The SYN is silently dropped at the Transit Gateway and never reaches VPC B. The instance in VPC A sees no SYN-ACK and eventually reports a connection timeout. The TGW forwards packets using only its own route table; with no entry for 10.1.0.0/16 (propagation is disabled and no static route was added), it has no attachment to forward to and discards the packet. The VPC A subnet route pointing at the TGW only gets the packet to the TGW; it does not give the TGW a path onward. VPC B's security groups and NACLs are never evaluated because the packet never arrives there. End-to-end connectivity requires routes in both the VPC route tables and the TGW route table, via propagation or static routes.
The Transit Gateway makes forwarding decisions solely from its TGW route table. The packet arrives from VPC A's attachment and the TGW looks up 10.1.0.0/16; since propagation is disabled and no static route exists, there is no matching route, so the packet is dropped. The sender observes a connection timeout because no SYN-ACK returns. The VPC subnet route tables are correctly configured but only deliver the packet to the TGW, and VPC B's security groups and NACLs are never reached. Both the VPC route tables and the TGW route table must contain appropriate routes for connectivity.
Related interview questions
Job market
See aws salaries and hiring demand from live job postings.
The other 1 question
This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 1 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan