AWS Cloud Practitioner 06: Networking and Global Delivery

AWS Cloud Practitioner 06: Networking and Global Delivery

Every EC2 instance, every RDS database and every load balancer lives in a network that we tailor ourselves. This network is called a Virtual Private Cloud (VPC), and on top of it come services that connect, filter and name networks and bring content quickly to users. In the Exam Guide this belongs to the largest domain, Cloud Technology and Services, at 34 percent. The exam does not require network planning, but it likes to ask which building block solves which problem and which two building blocks look alike.

The VPC as your own network in the Region

A VPC is a logically isolated network within a Region. It gets an address range in CIDR notation, for example 172.31.0.0/16, and is divided into subnets. A subnet always lives in exactly one Availability Zone. Anyone who wants to build for resilience therefore creates subnets in several AZs and spreads the instances across them, as described in part 01.

Every account comes with a ready-made default VPC in each Region. In eu-central-1 it has the range 172.31.0.0/16 and one subnet in each of the three AZs. That is enough for first experiments. For production workloads you usually create your own VPC with deliberately chosen subnets.

A VPC with a public and a private subnet in two AZs. The EC2 instances in the private subnet sit in a security group and reach the internet outbound only through the NAT gateway in the public subnet and the internet gateway. A gateway endpoint leads to S3 without the internet, Site-to-Site VPN and Direct Connect connect the own data center

The route table makes a subnet public

A subnet is not public because of its name. It is public if its route table contains a route to the internet gateway (IGW). The internet gateway attaches to the VPC and is the door to the outside. Without this route the subnet is private, and instances in it cannot be reached from the internet.

Private instances often still need a way out, for example for software updates. This is what the NAT gateway is for. It sits in a public subnet, and the route table of the private subnet sends internet traffic there. Traffic is therefore outbound only, and connections from outside do not come in. The NAT gateway is a service managed by AWS. The alternative is a NAT instance, an EC2 instance whose availability and scaling we look after ourselves (VPC docs). This is exactly the distinction the exam asks about: the internet gateway for both directions, the NAT gateway only for outbound traffic from private subnets.

Public addresses cost money. Since February 1, 2024, AWS charges 0.005 USD per hour for every public IPv4 address, even if it is attached to a running instance. Only your own addresses brought in through BYOIP are exempt (AWS News Blog, price as of October 25, 2026, a snapshot in time). At 730 hours that works out to about 3.65 USD per address and month. The Free Tier credit of 750 hours of public IPv4 now only applies in the legacy Free Tier for accounts created before July 15, 2025 (AWS re:Post). The automatically assigned public IPv4 address of an instance changes when we stop and start the instance again, while the private address is kept (AWS re:Post, EC2 docs). An Elastic IP, by contrast, is a fixed public IPv4 address that survives a stop and start, and it falls under the same fee.

NACL and security group filter at two levels

We know the security group from part 03 as a firewall directly at the instance. One level up sits the network ACL (NACL), which filters traffic at the subnet. Both check traffic against rules, but they work quite differently.

NACLSecurity group
Levelsubnetinstance or network interface (ENI)
RulesALLOW and DENYALLOW only
Statestateless, the return path needs its own rulestateful, the response is allowed automatically
ReferenceIP addresses onlyIP addresses and other security groups

The most important difference is in the State row. A security group remembers that a connection was initiated from the inside and lets the response back without another rule. A NACL remembers nothing. Anyone who allows inbound port 443 must also explicitly allow the outbound response in the NACL.

This leads to the typical division of labor. Actively blocking a specific IP address can only be done by the NACL, because only it knows DENY rules. The security group instead describes who may come in at all, and it can refer to other security groups. For example, we can specify that the database only accepts traffic from the instances of the web tier, without naming a single IP address.

For the exam, the Exam Guide in Task 3.5 also names Amazon Inspector as a building block for VPC security, alongside NACL and security group. Part 08 covers Inspector in detail.

VPC Flow Logs add visibility to the filters. They record the IP traffic of a VPC, a subnet or a single ENI and write it to S3, CloudWatch Logs or Firehose. Anyone who wants to know why a connection is rejected looks there.

Connecting VPCs to each other and to the data center

Once there is more than one VPC or your own data center joins in, the networks have to be connected. AWS offers several building blocks for this, which differ in reach and effort.

Building blockPurposeCharacteristic
VPC peeringconnect two VPCs privatelyCIDR ranges must not overlap, not transitive
Transit Gatewayhub-and-spoke for thousands of VPCs in a Region and on-premtransitive
VPC endpoint, gatewayprivate access to S3 and DynamoDBonly these two services
VPC endpoint, interfaceprivate access to AWS servicesmost services, including S3 and DynamoDB
PrivateLinkshare your own service with thousands of VPCsNetwork Load Balancer on the provider side, ENI on the consumer side
Site-to-Site VPNconnect data center to the VPCencrypted over the internet, quick to set up
Direct Connectconnect data center to AWSphysical private line, not over the internet
Client VPNsingle computer into the VPCOpenVPN-based

Not transitive is the keyword for peering. If VPC A and B are peered and B and C are too, A and C still cannot talk to each other. With three VPCs that is manageable, but with fifty the network of individual connections becomes hard to follow. The Transit Gateway solves this by attaching all VPCs and the on-prem connection to one central hub, through which they communicate transitively.

Gateway endpoint and interface endpoint both allow an instance in a private subnet to reach an AWS service without going through the internet gateway or NAT gateway. The gateway type exists only for S3 and DynamoDB. It costs nothing extra, but it cannot be used from your own data center, over Transit Gateway, or from peered VPCs in other Regions (VPC docs). The paid interface type is offered by most services, S3 and DynamoDB included. With S3 and DynamoDB we can therefore choose between both types, while all other services are reachable only through an interface endpoint (DynamoDB docs). PrivateLink reverses the perspective. Here the goal is not access to AWS services, but offering your own service privately to other VPCs.

For connecting your own data center, VPN and Direct Connect are the options. The Site-to-Site VPN is quickly set up and runs encrypted over the public internet. The connection has two ends. On the AWS side it terminates at a virtual private gateway attached to the VPC, or at a Transit Gateway. On the data center side sits the customer gateway, the resource AWS uses to describe the VPN device on premises (Site-to-Site VPN docs). Direct Connect is a physical line that has to be ordered and activated first. If the question says “immediately” or “quickly”, the answer is VPN, and if it says “private, not over the internet”, it is Direct Connect. The in-scope list names AWS VPN as an umbrella term and Site-to-Site VPN and Client VPN individually.

Route 53 translates names and distributes traffic

Amazon Route 53 is the DNS service of AWS and, as mentioned in part 01, a global service. It resolves names to addresses and decides which address a user gets. The exam asks about record types and routing policies.

Recordpoints to
Aan IPv4 address
AAAAan IPv6 address
CNAMEanother hostname
Aliasan AWS resource, such as a load balancer or a CloudFront distribution

The routing policy determines by which rule Route 53 answers. Simple just returns the stored value, without a health check. Weighted distributes traffic by weights, for example 90 to 10 for a careful rollout. Latency sends users to the Region with the lowest latency. Failover redirects to a backup target as soon as the primary target is no longer healthy. There are also Geolocation, Geoproximity, IP-based and Multivalue Answer (Route 53 docs).

CloudFront and Global Accelerator at the edge

CloudFront and Global Accelerator both work at the edge locations from part 01 and are therefore often confused. Both are protected against DDoS attacks by AWS Shield. Their purpose is still quite different.

Left, CloudFront: users get content from the edge location cache, the origin is only asked on a cache miss. Right, Global Accelerator: users reach the edge location through two static anycast IPs, from there traffic goes uncached over the AWS backbone to Region A, on failure to Region B. Both use Shield Standard

Amazon CloudFront is a content delivery network. It stores content for a defined time (TTL) in the edge locations and serves it from there. This suits anything that can be cached, such as images, videos and static web pages. AWS Global Accelerator caches nothing. It gives an application static IP addresses and routes traffic through the nearest edge location to the right endpoint. It fits when fixed IPs are needed, when the protocol is not HTTP, or when failover between Regions should be deterministic.

RequirementService
deliver images, video, static website quickly worldwideCloudFront
static IP addresses for a global applicationGlobal Accelerator
accelerate non-HTTP trafficGlobal Accelerator
deterministic failover between RegionsGlobal Accelerator
speed up large uploads to S3 from far awayS3 Transfer Acceleration

The third edge service is S3 Transfer Acceleration. It speeds up uploads into an S3 bucket by having the upload arrive at the nearest edge location instead of directly in the distant Region.

Another mix-up concerns CloudFront and S3 Cross-Region Replication (CRR) from part 04. CloudFront caches globally, but only for the duration of the TTL. CRR copies new objects automatically and asynchronously to one or more buckets in other Regions, where they stay permanently as their own copy (S3 User Guide). Anyone who wants low latency for readers worldwide uses CloudFront. Anyone who needs a second copy in another Region uses CRR.

Some networking services are explicitly on the out-of-scope list according to the Exam Guide and are therefore not relevant for the exam, including VPC Lattice, Cloud Map, Network Access Analyzer and Ground Station.

Hands-on

Let’s look at the default VPC in eu-central-1 and then create a security group. Both are free. Costs arise once an instance with a public IPv4 address or an Elastic IP is added. The outputs are shortened and IDs truncated.

First the VPC itself and its subnets.

VPC_ID=$(aws ec2 describe-vpcs --region eu-central-1 \
  --filters Name=is-default,Values=true \
  --query 'Vpcs[0].VpcId' --output text)

aws ec2 describe-vpcs --region eu-central-1 --vpc-ids "$VPC_ID" \
  --query 'Vpcs[].CidrBlock' --output text
172.31.0.0/16

In the console: VPC → Your VPCs → click the VPC ID; the details list IPv4 CIDR, Default VPC, Main route table and Main network ACL, and the Resource map tab shows how the parts connect.

Resource map of the default VPC in the console: VPC, three subnets in eu-central-1a, 1b and 1c, one route table and an internet gateway igw-… as network connection

aws ec2 describe-subnets --region eu-central-1 \
  --filters Name=vpc-id,Values="$VPC_ID" \
  --query 'Subnets[].[AvailabilityZone,CidrBlock,MapPublicIpOnLaunch]' \
  --output text
eu-central-1a   172.31.16.0/20   True
eu-central-1b   172.31.32.0/20   True
eu-central-1c   172.31.0.0/20    True

In the console: VPC → Subnets.

One subnet per AZ, and all of them assign a public address automatically at launch. The route table shows why they are public.

aws ec2 describe-route-tables --region eu-central-1 \
  --filters Name=vpc-id,Values="$VPC_ID" \
  --query 'RouteTables[].Routes[].[DestinationCidrBlock,GatewayId]' \
  --output text
172.31.0.0/16   local
0.0.0.0/0       igw-…

In the console: VPC → Route tables.

The first route keeps traffic inside the VPC, the second sends everything else to the internet gateway. This second line is what makes the default subnets public.

The default NACL lets everything through.

aws ec2 describe-network-acls --region eu-central-1 \
  --filters Name=vpc-id,Values="$VPC_ID" Name=default,Values=true \
  --query 'NetworkAcls[].Entries[].[Egress,RuleNumber,RuleAction]' \
  --output text
False   100     allow
False   32767   deny
True    100     allow
True    32767   deny

In the console: VPC → Network ACLs.

Rule 100 allows all traffic, inbound (Egress False) as well as outbound (Egress True). Rule 32767 is the asterisk rule at the end, which denies everything not allowed before. With the default NACL it practically never applies. The default security group of the same VPC allows inbound traffic only from members of the same security group and outbound everything to 0.0.0.0/0. It can be queried like this:

aws ec2 describe-security-groups --region eu-central-1 \
  --filters Name=vpc-id,Values="$VPC_ID" Name=group-name,Values=default

In the console: VPC → Security groups.

The inbound rule is the reference to another security group from the table above, here to itself.

Let’s create our own security group for a web server. HTTPS may come from anywhere, SSH only from a specific network. For the example we use 203.0.113.0/24, an address range reserved for documentation.

SG_ID=$(aws ec2 create-security-group --region eu-central-1 \
  --group-name ccp-demo-web --description "CCP Demo Webserver" \
  --vpc-id "$VPC_ID" --query GroupId --output text)

aws ec2 authorize-security-group-ingress --region eu-central-1 \
  --group-id "$SG_ID" --protocol tcp --port 443 --cidr 0.0.0.0/0

aws ec2 authorize-security-group-ingress --region eu-central-1 \
  --group-id "$SG_ID" --protocol tcp --port 22 --cidr 203.0.113.0/24

aws ec2 describe-security-groups --region eu-central-1 --group-ids "$SG_ID" \
  --query 'SecurityGroups[].IpPermissionsEgress[].[IpProtocol,IpRanges[0].CidrIp]' \
  --output text
-1   0.0.0.0/0

We did not create an egress rule. AWS set it automatically on creation, and protocol -1 stands for all traffic. It would not even be needed for the responses to inbound HTTPS requests, because the security group is stateful.

In the console: VPC → Security groups → Create security group (alternatively EC2 → Network & Security → Security Groups); the detail page splits the rules into the tabs Inbound rules and Outbound rules.

Detail page of the security group ccp-demo-web: inbound rules with HTTPS TCP 443 from 0.0.0.0/0 and SSH TCP 22 from 203.0.113.0/24, outbound rules with All traffic to 0.0.0.0/0

Finally, we check whether any Elastic IPs are lying around in the account that would cause fees.

aws ec2 describe-addresses --region eu-central-1 \
  --query 'length(Addresses)'
0

In the console: VPC → Elastic IPs.

Cleanup here is a single command. We leave the default VPC in place.

aws ec2 delete-security-group --region eu-central-1 --group-id "$SG_ID"

For the exam

Keyword in the questionAnswer
subnet reachable from the internetroute to the internet gateway in the route table
private instance needs updates from the internetNAT gateway
actively block a single IP addressNACL (DENY rule)
firewall at instance level, statefulSecurity group
connect two VPCs privatelyVPC peering
many VPCs and on-prem centrally, transitiveTransit Gateway
reach S3 or DynamoDB without the internetGateway endpoint
offer your own service privately to other VPCsPrivateLink
quick and encrypted to the data centerSite-to-Site VPN
VPN endpoint on the AWS sideVirtual private gateway (or Transit Gateway)
VPN endpoint in your own data centerCustomer gateway
private line, not over the internetDirect Connect
employee laptop into the VPCClient VPN
capture IP traffic for analysisVPC Flow Logs
users to the Region with the lowest latencyRoute 53 latency routing
cache static content worldwideCloudFront
static IPs, non-HTTP protocol, failover between RegionsGlobal Accelerator
speed up uploads to S3 from far awayS3 Transfer Acceleration

Typical traps:

  • Mixing up stateless and stateful. The NACL is stateless and needs a rule for the return path, the security group is stateful.
  • Peering for many VPCs. Peering is not transitive. As soon as the question mentions many VPCs or a central hub, Transit Gateway is meant.
  • Gateway endpoint for every service. The gateway type exists only for S3 and DynamoDB, everything else needs an interface endpoint.
  • NAT gateway for inbound traffic. The NAT gateway only lets private instances out, not in.
  • Global Accelerator as a cache. Global Accelerator speeds up the connection but caches no content. Caching is CloudFront.

Sources

Part 07 covers the services that decouple applications through messages, roll out infrastructure as code and monitor operations, from SQS and SNS through CloudFormation to CloudWatch and CloudTrail.