☰ All modules Tier 4 · VPC GuideCheat sheet ‹ route53
Contents
  1. How VPC appears on DVA-C02
  2. 1. Subnets route tables and gateways
  3. 2. Security groups network ACLs and flow logs
  4. 3. VPC endpoints for AWS services
  5. 4. Lambda functions in a VPC
  6. 5. Peering VPN and Direct Connect
  7. Quick decision rules
  8. Changed vs older material

VPC — DVA-C02 Mastery Guide

  • Sources: course chapter 05 (VPC). The slides serve as the syllabus only; all wording here is original.
  • Written 2026-10-12; values checked against AWS docs on 2026-10-12. The marker ⚠️ Changed: <current>. Older material may say <old>. flags a value or behaviour that differs from the course or from older practice tests: learn the current value. ⚠️ unverified marks anything that could not be confirmed in AWS documentation. Every change is listed in Changed vs older material; rows enter notes/current-facts.md once you confirm them.
  • Tier 4 (skim: developer-facing features only), bank target 10 questions. Domains: Troubleshooting and Optimization (primary), Security.
  • Scope: public vs private subnets, internet and NAT gateways, security groups vs network ACLs, VPC endpoints (gateway vs interface), flow logs, peering, Lambda in a VPC (reaching the internet and AWS services), Site-to-Site VPN and Direct Connect awareness. Covered elsewhere: security group rules, defaults, quotas and the timeout-vs-refused diagnosis → notes/ec2-mastery-guide.md §4; EFS mount targets → notes/ec2-mastery-guide.md §7; Lambda VpcConfig, execution-role permissions, Hyperplane ENI states and VPC invoke errors → notes/lambda-guide.md §10; private REST APIs → notes/api-gateway-guide.md §2; aws:SourceIp and other condition-key basics → notes/iam-guide.md §5; explicit-deny evaluation → notes/advanced-identity-guide.md §11; DynamoDB table policies → notes/dynamodb-guide.md §13; bucket policy grammar → notes/s3-guide.md §2; CloudWatch Logs Insights → notes/monitoring-guide.md §4; CodeBuild vpcConfig → notes/cicd-guide.md §3.
  • How to use it: /explain <topic> teaches from these sections (concept → exam facts → developer angle → traps → 3 check questions); /quiz vpc asks bank questions whose source_note links point at the ## N. headings below; /drill vpc fires short recall prompts from notes/vpc-cheat-sheet.md. Suggested loop: read a section, answer its practice questions before opening the answers, /explain what is still unclear, then /quiz vpc and /drill vpc.

How VPC appears on DVA-C02

DVA-C02 doesn't test network design. VPC shows up as the environment around your code: a function or instance that can't reach something, a resource that must stay private, a log that has to explain a dropped connection. What you must get right:

Typical question shapes: a timeout after a configuration change; "MOST secure" or "MOST cost-effective" private access to S3 or DynamoDB; a flow log excerpt to interpret; "Which TWO…" steps to make a connection work.

Domain map: Troubleshooting and Optimization → §1 (NAT metrics), §2 (flow logs), §4 (timeouts) · Security → §2 (filtering), §3 (endpoint policies and condition keys), §5 (encryption of links).

Out of scope here: CIDR planning, routing architecture, Transit Gateway and Cloud WAN design, BGP, IPv6 migration, appliance inspection designs, and the rarer endpoint types (Gateway Load Balancer endpoints, the resource and service-network endpoints added in Dec 2024 for VPC Lattice and shared resources, and endpoint services that publish your own load-balancer-fronted service to other VPCs).

# Topic Why it is on the exam
1 Subnets route tables and gateways What makes a subnet public, how private resources get outbound internet, NAT gateway limits and metrics
2 Security groups network ACLs and flow logs Stateful vs stateless filtering, return traffic, reading flow log records to find the blocker
3 VPC endpoints for AWS services Gateway vs interface endpoints, private DNS, endpoint policies and aws:SourceVpce conditions
4 Lambda functions in a VPC Why an attached function loses internet access and how NAT or endpoints restore each call
5 Peering VPN and Direct Connect Point-to-point peering rules and the VPN vs Direct Connect choice for on-premises links

1. Subnets route tables and gateways

Concept

Exam facts

Developer angle

# Zonal public NAT gateway (Elastic IP from: aws ec2 allocate-address --domain vpc) + the private default route
aws ec2 create-nat-gateway --subnet-id subnet-0a1b2c3d4e5f60718 --allocation-id eipalloc-0123456789abcdef0
aws ec2 create-route --route-table-id rtb-0b2c3d4e5f6071829 \
  --destination-cidr-block 0.0.0.0/0 --nat-gateway-id nat-0123456789abcdef0
aws ec2 create-nat-gateway --vpc-id vpc-0123456789abcdef0 --availability-mode regional  # regional, automatic mode: no subnet
# Routes a subnet uses; empty output = implicit association with the main route table
# (gateway endpoint routes have no CIDR: DestinationPrefixListId shows their pl-… destination)
aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0f1e2d3c4b5a69788 \
  --query 'RouteTables[].Routes[].[DestinationCidrBlock,DestinationPrefixListId,GatewayId,NatGatewayId,State]' --output table

Traps

Practice questions

  1. A team runs containers on EC2 instances in private subnets across three Availability Zones. One NAT gateway in the first AZ serves every private subnet. The team must keep outbound internet access if any single AZ fails and wants the fewest route-table changes when workloads later expand into a fourth AZ. What should the developer do?

    • A. Create an egress-only internet gateway and route 0.0.0.0/0 from every private subnet to it.
    • B. Launch a NAT instance in each AZ from the AWS NAT AMI and route each subnet to its local instance.
    • C. Create a regional NAT gateway and point the default route of every private subnet at its ID.
    • D. Associate two secondary Elastic IP addresses with the existing NAT gateway.
  2. An application in private subnets opens thousands of short HTTPS connections per minute to one partner endpoint through a public NAT gateway. New connections fail intermittently, and the NAT gateway's ErrorPortAllocation metric is above zero. Which TWO actions reduce these failures? (Select TWO.)

    • A. Attach a security group to the NAT gateway that allows the whole ephemeral port range.
    • B. Associate secondary IPv4 addresses with the NAT gateway.
    • C. Raise the rules-per-network-ACL quota for the NAT gateway's subnet.
    • D. Reuse connections through keep-alive connection pooling in the HTTP client.
    • E. Send the private subnets' default route to an egress-only internet gateway.
Answers
  1. C. A regional NAT gateway spans AZs by itself and keeps one ID in every route table, including for subnets in a new AZ. A carries IPv6 only; B adds instances to patch and fail over, and the AWS NAT AMI is out of support; D adds ports but the gateway still lives in one AZ.
  2. B, D. Each extra IP adds 55,000 connections per destination, and pooling cuts the number of new connections. A is impossible (no security groups on NAT gateways); C has nothing to do with source ports; E handles IPv6 only.

2. Security groups network ACLs and flow logs

Concept

Exam facts

Security group Network ACL
Attached to ENI (instances, Lambda, endpoints, RDS, load balancers) Subnet: exactly one per subnet; one NACL can serve many subnets
State Stateful: replies allowed automatically Stateless: return traffic needs its own rule for the client's ephemeral ports (NAT gateways, ELB and Lambda 1024–65535; many Linux kernels 32768–61000; Windows Server 2008+ 49152–65535); AWS suggests allowing 1024–65535 with lower-numbered denies for unwanted ports
Rules Allow only; CIDR, prefix list or SG ID Allow and deny; CIDR only (no SG IDs, no prefix lists)
Evaluation All rules combined Lowest number first (1–32766), first match wins; the * catch-all deny can't be deleted
Defaults and quota New SG: no inbound, all outbound; 60 inbound + 60 outbound rules Default NACL: allows everything; new custom NACL: denies everything; 20 rules per direction (adjustable to 40)

Developer angle

# Deny one abusive address at rule 90, before rule 100 that allows 443 from 0.0.0.0/0; let replies out
aws ec2 create-network-acl-entry --network-acl-id acl-0123456789abcdef0 --ingress --rule-number 90 \
  --protocol tcp --port-range From=443,To=443 --cidr-block 198.51.100.7/32 --rule-action deny
aws ec2 create-network-acl-entry --network-acl-id acl-0123456789abcdef0 --egress --rule-number 100 --protocol tcp --port-range From=1024,To=65535 --cidr-block 0.0.0.0/0 --rule-action allow
# Rejected traffic of one subnet to CloudWatch Logs, 1-minute aggregation
aws ec2 create-flow-logs --resource-type Subnet --resource-ids subnet-0a1b2c3d4e5f60718 --traffic-type REJECT \
  --log-group-name /vpc/app-subnet/rejects --max-aggregation-interval 60 --deliver-logs-permission-arn arn:aws:iam::111122223333:role/FlowLogsToCloudWatch

Traps

Practice questions

  1. A developer runs an HTTPS service on an instance in a public subnet that uses a custom network ACL. Requests from internet clients time out. The flow log for the instance's network interface shows an ACCEPT record from a client to port 443 and a REJECT record from port 443 back to the client's port 51544. What is the most likely cause?

    • A. The instance's security group has no outbound rule that allows the HTTPS responses.
    • B. The network ACL has no outbound rule that allows TCP 1024–65535 to the clients.
    • C. The instance's security group has no inbound rule for TCP 443.
    • D. The subnet's route table has no route to the internet gateway.
  2. A CI role runs aws ec2 create-flow-logs to send one subnet's rejected traffic to a CloudWatch Logs log group. Which TWO are required for the flow log to be created and delivered? (Select TWO.)

    • A. An IAM role that vpc-flow-logs.amazonaws.com can assume, with CloudWatch Logs write permissions.
    • B. The CloudWatch agent installed and running on every instance in the subnet.
    • C. iam:PassRole permission for the CI role on that delivery role.
    • D. A bucket policy that lets delivery.logs.amazonaws.com call s3:PutObject.
    • E. The enableDnsHostnames attribute turned on for the VPC.
Answers
  1. B. The request was accepted, so inbound filtering is fine; the reply to an ephemeral port was rejected, which only a stateless NACL does. A is wrong because security groups allow replies automatically; C would have produced a REJECT for the request; a missing route doesn't appear as a REJECT record, which rules out D.
  2. A, C. Flow logs publish to CloudWatch Logs through a delivery role, and handing that role to the service needs iam:PassRole. B is for instance metrics and logs, not flow logs; D applies to an S3 destination; E has nothing to do with log delivery.

3. VPC endpoints for AWS services

Concept

Exam facts

Gateway endpoint Interface endpoint
Services S3, DynamoDB S3, DynamoDB and the large majority of other AWS services, plus partner and your own services
Mechanism Prefix-list route in the associated route tables ENI with private IPs per AZ, reached through DNS
Reachable from Only resources in subnets whose route tables are associated The VPC, peered VPCs, on-premises over VPN or Direct Connect, transit gateways
Network controls Client SG egress can reference the prefix list Endpoint SG must allow inbound 443 from callers (the VPC's default SG if none is chosen)
Limits and cost 20 per Region (adjustable), 255 per VPC; no charge 50 interface plus Gateway Load Balancer endpoints per VPC (adjustable); 10 Gbps per AZ scaling to 100 Gbps; no reply to ping; per hour per AZ plus per GB

Developer angle

# S3 gateway endpoint (Gateway is the default --vpc-endpoint-type); then an interface endpoint with private DNS
aws ec2 create-vpc-endpoint --vpc-id vpc-0123456789abcdef0 --service-name com.amazonaws.eu-west-1.s3 --route-table-ids rtb-0b2c3d4e5f6071829 rtb-0c3d4e5f607182930
aws ec2 modify-vpc-attribute --vpc-id vpc-0123456789abcdef0 --enable-dns-hostnames "{\"Value\":true}"  # one attribute per call
aws ec2 create-vpc-endpoint --vpc-id vpc-0123456789abcdef0 --vpc-endpoint-type Interface --private-dns-enabled \
  --service-name com.amazonaws.eu-west-1.secretsmanager --subnet-ids subnet-0a1b2c3d4e5f60718 subnet-0f1e2d3c4b5a69788 --security-group-ids sg-0aa11bb22cc33dd44

Traps

Practice questions

  1. Instances in private subnets with no NAT gateway write nightly exports to an S3 bucket in the same Region. Security requires that the traffic never uses an internet path, and the team wants the MOST cost-effective solution. What should the developer do?

    • A. Create an interface endpoint for S3 in each private subnet and enable private DNS.
    • B. Add a NAT gateway in a public subnet and limit the bucket policy to its Elastic IP with aws:SourceIp.
    • C. Turn on S3 Transfer Acceleration and upload to the accelerate endpoint.
    • D. Create a gateway endpoint for S3 and associate it with the private subnets' route tables.
  2. An application on instances in private subnets calls Amazon SQS through an interface endpoint with private DNS; from the instances the queue's hostname resolves to private IPs. The endpoint uses a new security group with no inbound rules, and the instances' security group allows outbound traffic only to the database security group on TCP 5432. Calls to SQS time out. Which TWO changes fix the timeouts? (Select TWO.)

    • A. Add a 0.0.0.0/0 route that targets the endpoint in the private subnets' route tables.
    • B. Add an inbound TCP 443 rule to the endpoint's security group with the instances' security group as the source.
    • C. Replace the default endpoint policy with one that allows sqs:SendMessage for the instance role.
    • D. Turn on the enableDnsHostnames attribute of the VPC so that private DNS names resolve.
    • E. Add an outbound TCP 443 rule to the instances' security group with the endpoint's security group as the destination.
Answers
  1. D. A gateway endpoint gives S3 a private path at no charge. A works but adds hourly and per-GB charges; B sends the traffic out through the internet gateway and pays NAT processing; C is a public, internet-based upload path.
  2. B, E. Both security groups block HTTPS: the endpoint ENI must accept 443 from the instances, and the instances must be allowed to send it. A is wrong because interface endpoints are reached by DNS, not as route targets; C addresses AccessDenied, not timeouts (and the default policy already allows everything); D is unnecessary because names already resolve to the endpoint.

4. Lambda functions in a VPC

Concept

Exam facts

Developer angle

# Attach the function to two private subnets with its own security group; detach again with empty lists
aws lambda update-function-configuration --function-name orders-api \
  --vpc-config SubnetIds=subnet-0a1b2c3d4e5f60718,subnet-0f1e2d3c4b5a69788,SecurityGroupIds=sg-0aa11bb22cc33dd44
aws lambda update-function-configuration --function-name orders-api --vpc-config SubnetIds=[],SecurityGroupIds=[]

Fail fast instead of burning the whole function timeout when a path is missing:

import boto3
from botocore.config import Config
sns = boto3.client("sns", config=Config(connect_timeout=3, read_timeout=5, retries={"max_attempts": 2, "mode": "standard"}))

Traps

Practice questions

  1. A function was attached to private subnets so it can read from an ElastiCache cluster. It must also publish to an Amazon SNS topic, and the security team forbids any route from these subnets to the internet. Since the change, the publish calls time out. What should the developer do?

    • A. Create an SNS interface endpoint with private DNS in the function's subnets.
    • B. Move the function to public subnets that route to the internet gateway.
    • C. Create a gateway VPC endpoint for SNS and associate the subnets' route tables.
    • D. Add a NAT gateway and send the private subnets' default route to it.
  2. A developer attaches an existing function to private subnets so it can query an Aurora cluster. The function also downloads large objects from an S3 bucket in the same Region and calls a public exchange-rate API over HTTPS. The VPC has an internet gateway but no NAT gateway. Which TWO actions restore both calls at the LOWEST cost? (Select TWO.)

    • A. Create an S3 interface endpoint in each private subnet.
    • B. Move the function to public subnets that auto-assign public IPv4 addresses.
    • C. Create an S3 gateway endpoint and associate it with the private subnets' route tables.
    • D. Create a NAT gateway in a public subnet and route the private subnets' 0.0.0.0/0 traffic to it.
    • E. Create an interface endpoint for the exchange-rate API's domain name.
Answers
  1. A. An interface endpoint gives SNS a private path with no internet route, and private DNS keeps the SDK code unchanged. B fails because the function never gets a public IP (and breaks the rule); C exists only for S3 and DynamoDB; D adds the forbidden internet route.
  2. C, D. The free gateway endpoint carries the large S3 downloads without NAT processing charges, and only a NAT gateway can reach the public API. A works for S3 but costs more; B gives no public IP; E is impossible for an arbitrary public API that doesn't offer PrivateLink.

5. Peering VPN and Direct Connect

Concept

Exam facts

Developer angle

# Cross-account, cross-Region peering: request, accept (as the accepter), route both ways
aws ec2 create-vpc-peering-connection --vpc-id vpc-0aaa1111bbbb22223 \
  --peer-vpc-id vpc-0ccc3333dddd44445 --peer-owner-id 444455556666 --peer-region eu-central-1
aws ec2 accept-vpc-peering-connection --vpc-peering-connection-id pcx-0123456789abcdef0 --region eu-central-1
aws ec2 create-route --route-table-id rtb-0b2c3d4e5f6071829 \
  --destination-cidr-block 10.20.0.0/16 --vpc-peering-connection-id pcx-0123456789abcdef0
# Requester's side, set by its owner in its Region: lets the accepter VPC resolve the requester's public DNS hostnames
# to private IPs; for the reverse, the accepter's owner sets --accepter-peering-connection-options in eu-central-1
aws ec2 modify-vpc-peering-connection-options --vpc-peering-connection-id pcx-0123456789abcdef0 \
  --requester-peering-connection-options AllowDnsResolutionFromRemoteVpc=true

Traps

Practice questions

  1. A company has VPCs A, B and C in one Region with non-overlapping CIDRs. A is peered with B, and B is peered with C. An application in VPC A must call a service in VPC C. Which solution needs the fewest new resources?

    • A. Add a route in VPC A for VPC C's CIDR that targets the existing A–B peering connection.
    • B. Enable DNS resolution on both existing peering connections.
    • C. Peer VPC A with VPC C and add routes for each other's CIDR in both VPCs.
    • D. Create a NAT gateway in VPC B and route VPC A's traffic for VPC C through it.
  2. A company moves a nightly 20 TB database export from its data center to AWS. It needs consistent throughput that doesn't depend on internet conditions, and its policy requires encryption on the network link itself. Which TWO steps meet the requirements? (Select TWO.)

    • A. Order a 10 Gbps dedicated Direct Connect connection at a location that supports MACsec.
    • B. Rely on the encryption that Direct Connect applies to all traffic by default.
    • C. Use a Site-to-Site VPN over the internet as the only connection.
    • D. Configure MACsec on the dedicated connection with a CKN/CAK key pair.
    • E. Peer the data center network with the VPC through VPC peering.
Answers
  1. C. Peering isn't transitive, so A and C need their own connection with routes on both sides. A fails because traffic can't transit VPC B; B only changes name resolution; D is edge-to-edge routing through a peer's gateway, which isn't supported.
  2. A, D. A dedicated connection gives consistent private bandwidth, and MACsec encrypts the link. B is wrong because DX doesn't encrypt by default; C depends on internet conditions; E only connects VPCs, not on-premises networks.

Quick decision rules

Subnets, NAT and filtering (§1–§2)

Endpoints and Lambda (§3–§4)

Connecting networks (§5)

Changed vs older material

Learn the Current column; older practice material may still show the Older material may say value. Once you confirm them, the same rows go to notes/current-facts.md with their verification dates.

Topic Older material may say Current (verified 2026-10-12) Source
§1 · NAT gateway availability A NAT gateway always lives in one AZ inside a public subnet; HA means one per AZ Zonal NAT gateways still work that way; since 19 Nov 2025 a regional NAT gateway (--availability-mode regional) needs no public subnet, expands across AZs (up to 60 min for a new AZ), uses one ID in all routes, up to 32 IPs per AZ, no private mode AWS docs
§1 · NAT gateway throughput Up to 45 Gbps and 4 million packets per second 5 Gbps scaling to 100 Gbps; 1 to 10 million packets per second (since June 2022) AWS docs
§1 · NAT instances Launch a NAT instance from the AWS NAT AMI NAT AMI (Amazon Linux AMI 2018.03) out of maintenance support since 31 Dec 2023; AWS recommends NAT gateways, or a NAT AMI you build from current Amazon Linux AWS docs
§1 · Blocking internet access An IGW route plus a public IP always means internet access VPC Block Public Access (since 19 Nov 2024) can block IGW and egress-only IGW traffic per account and Region, with VPC or subnet exclusions; flow log reject-reason BPA AWS docs
§2 · Flow log destinations S3, CloudWatch Logs, Kinesis Data Firehose S3, CloudWatch Logs, Amazon Data Firehose (renamed Feb 2024; CLI value still kinesis-data-firehose) AWS docs
§2 · Flow log resources VPC, subnet and network interface flow logs Also transit gateways, transit gateway attachments and regional NAT gateways (--resource-type) AWS docs
§3 · DynamoDB endpoint types DynamoDB supports only gateway endpoints Gateway or interface endpoints (PrivateLink since 19 Mar 2024); no private DNS for the interface endpoint, so use its endpoint URL What's New
§3 · S3 interface endpoint DNS S3 interface endpoints always need endpoint-specific DNS names Private DNS supported; "private DNS only for inbound endpoint" (default when enabled) keeps in-VPC traffic on the S3 gateway endpoint AWS docs
§3 · Endpoints across Regions VPC endpoints reach services in their own Region only Interface endpoints reach some AWS services in another Region (--service-region, vpce:AllowMultiRegion); gateway endpoints stay same-Region AWS docs
§5 · Site-to-Site VPN tunnel size 1.25 Gbps per tunnel Standard tunnel 1.25 Gbps and 140,000 packets/s; Large Bandwidth Tunnel up to 5 Gbps and 400,000 packets/s on a transit gateway or Cloud WAN AWS docs
§5 · Direct Connect encryption A private DX line is already secure, no encryption needed Not encrypted in transit by default; add MACsec (10/100/400 Gbps dedicated) or an IPsec VPN over DX AWS docs
§5 · Direct Connect lead time A month or more before the link works (course) ⚠️ unverified: AWS documents up to 72 business hours to review the request and provision the port; the cross-connect is ordered afterwards with the LOA-CFA; no end-to-end figure AWS docs