Find a course

Module 2: Core Building BlocksLesson 6 of 1211 min

Regions, Availability Zones and Cloud Networking

Learn how regions and availability zones are organized, how virtual private clouds, subnets and security groups work, and what load balancers and CDNs do.

Step 1 of 13Learn

Regions and availability zones

Cloud providers organize their infrastructure geographically.

A region is a geographic area, such as Northern Virginia, Frankfurt, São Paulo or Tokyo, where the provider runs data centers. Regions are largely independent of each other. You choose a region for every resource, and the choice affects:

  • Latency: users get faster responses from a nearby region.
  • Legal requirements: data residency rules may require a specific country or area.
  • Price: the same service can cost different amounts in different regions.
  • Service availability: newer services often launch in some regions first.

Within a region are several availability zones (AZs), typically three or more. Each AZ is one or more data centers with independent power, cooling and networking, physically separated by meaningful distances (often several miles to tens of miles) so a flood, fire or power failure in one is unlikely to affect another. AZs in a region are connected by fast, low-latency links, so an application can run in several AZs at once as if they were one location.

This structure is the foundation of cloud reliability. A single server in a single AZ can fail at any time. An application running in two or three AZs can lose an entire data center and keep serving users. Running in multiple regions protects against the rarer event of a whole region having problems, at a higher cost and complexity.

Providers also run many smaller edge locations in cities worldwide, used for content delivery and DNS close to users.

A region containing three availability zones, each with its own data centersRegionZone AZone BZone C

Step 2 of 13Practice · Fill in the blanks

Fill in the blanks

A provider's geographic area, such as Frankfurt, is called a . Each one contains several isolated data center groups with independent power and networking, called .

Step 3 of 13Learn

Virtual private clouds, subnets and security groups

In the cloud, you build your own private network on top of the provider's: a virtual private cloud (VPC), called a virtual network (VNet) in Azure. It's an isolated network with an address range you choose, such as 10.0.0.0/16, using the same IP addressing and CIDR ideas used everywhere in networking.

Inside the VPC you create subnets, usually one or more per availability zone:

  • Public subnets have a route to an internet gateway, so resources there, such as load balancers, can be reached from the internet if their security rules allow it.
  • Private subnets have no direct inbound route from the internet. Application servers and databases live here. They can still reach out for updates through a NAT gateway.

Traffic is controlled by security groups, virtual firewalls attached to individual resources. A typical three-tier setup:

  • The load balancer's group allows HTTPS (443) from anywhere.
  • The web servers' group allows traffic only from the load balancer's group.
  • The database's group allows port 5432 (PostgreSQL) only from the web servers' group.

Security groups are stateful and deny by default: anything not explicitly allowed is blocked, and replies to allowed traffic flow back automatically. Many providers also offer subnet-level network access control lists as a second layer. To connect a VPC to an office or data center, you use a site-to-site VPN or a dedicated private connection.

Step 4 of 13Practice · Put in order

Order the layers a user's request passes through in a typical secure three-tier cloud app, from the internet inward.

Drag the items, or use the arrow buttons, to put them in order.

  1. Managed database in a private subnet
  2. Load balancer in a public subnet
  3. Web or application servers in a private subnet
  4. Internet gateway of the VPC

Step 5 of 13Diagram

A secure three-tier request path

A secure three-tier request pathProcess diagram: User on the internet → Load balancer → App servers → Database.User on theinternetLoadbalancerApp serversDatabase

Tap a shape with to see more.

User on the internet
Load balancer

The only public entry point, in a public subnet.

App servers

Private subnet; accept traffic only from the load balancer.

Database

Private subnet; accepts traffic only from the app servers.

Step 6 of 13Practice · Spot the mistake

A team wrote these security group rules for their app. Tap the two rules that create unnecessary risk.

Step 7 of 13Learn

Load balancers and CDNs

Two services sit in front of most cloud applications.

A load balancer receives incoming requests and spreads them across several healthy servers or containers. It runs health checks, regularly testing each target, and stops sending traffic to any that fail, so users don't notice when one instance crashes. Load balancers usually span multiple availability zones, handle HTTPS certificates (TLS termination) and can route by path, so /api goes to one group of servers and /images to another. They're also what makes scaling out work: new instances register with the load balancer and immediately start taking traffic.

A content delivery network (CDN) caches copies of content at edge locations in hundreds of cities. When a user in Sydney requests an image from a site hosted in Virginia, the CDN serves it from a nearby edge after the first request, cutting latency from perhaps 200 ms to 20 ms and taking load off the origin servers. CDNs serve images, videos, scripts and whole static websites, and often add protection against DDoS attacks and a web application firewall (WAF).

Cloud providers also offer managed DNS services that route users to the closest or healthiest region, which is how global applications send each user to the best location.

Step 8 of 13Diagram

How a CDN serves a page

How a CDN serves a pageProcess diagram: Reader requests an image → Nearest edge location → Cached? Serve it at once → Not cached: fetch from origin.Readerrequests animageNearest edgelocationCached?Serve it atonceNot cached:fetch fromorigin

Tap a shape with to see more.

Reader requests an image
Nearest edge location

Often in the same city or country.

Cached? Serve it at once

Most requests end here.

Not cached: fetch from origin

Then keep a copy at the edge for the next reader.

Step 9 of 13Practice · Match the pairs

Match each cloud networking component to its job.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. VPC
  2. Private subnet
  3. Security group
  4. Load balancer
  5. CDN

Step 10 of 13Note

Step 11 of 13Practice · Chart

Typical round-trip time from London

Tap the region that gives London users the fastest response.

Tap the bar that answers the question, then press Check.

Typical round-trip time from LondonBar chart with 4 categories: Frankfurt: 15 ms; Northern Virginia: 75 ms; Tokyo: 230 ms; Sydney: 270 ms.0 ms100 ms200 ms300 msFrankfurt15 msNorthern Virginia75 msTokyo230 msSydney270 ms
Approximate typical values; real routes and conditions vary.
Typical round-trip time from London
ItemRound trip
Frankfurt15 ms
Northern Virginia75 ms
Tokyo230 ms
Sydney270 ms

Step 12 of 13Practice · Choose one

A company's customers are mostly in Germany, and its customer data must stay in the EU. Which region choice makes most sense?

Step 13 of 13Practice · What would you do?

What would you do?

A news site hosted in one US region is fast for American readers but slow for readers in Asia, especially for images and videos. The articles are the same for everyone. What's the most effective first step?