AWS Global Infrastructure
AWS has data centres all over the world, grouped into regions, availability zones and edge locations. You see where they are, measure how much slower a far-away region is for your users, and learn why your app should run close to the people who use it.
What you will be able to do
- Describe regions, availability zones and edge locations as one picture
- Read region codes like ap-south-1
- Measure how distance to a region changes response time
- Weigh latency, price and law when choosing a region
- Know what an edge location can and cannot speed up
The idea, in plain English
The cloud is not in the sky. It is rows of servers in buildings, in real cities, connected by cables under the sea. AWS groups them in three layers: regions (a geographic area, like Mumbai), availability zones (separate data centres inside a region), and edge locations (small sites in many more cities, close to users).
Where your app runs decides three things. Speed: light in a fibre cable needs time, so a server across the world is slower for your users. Law: some data must stay inside a country. Cost: the same server has different prices in different regions. In Lesson 2 we saw that resources live in one region - now we see what that region physically means.
We measure it for real: AWS’s public price lists, boto3’s built-in list of regions, round trips from a laptop in Hyderabad to the public health-check address of six regions, and the headers CloudFront sends back. None of it needs an AWS account. boto3 1.44.4, Python 3.13.12.
Worked example: Where an Indian online shop’s data physically lives - and what the distance costs: real round trips from Hyderabad to six AWS regions, and a real CloudFront edge in Hyderabad.
Words you will see in this lesson
A few infrastructure words.
RegionA geographic area with several AWS data centres, like ap-south-1 (Mumbai). Lesson 4.Availability zone (AZ)One or more data centres inside a region, with its own power and network. Lesson 5.Edge locationA small AWS site close to users, used by CloudFront and Route 53. Lesson 6.LatencyThe time a message needs to travel - here, in milliseconds (ms).Round tripThere and back once: the smallest possible wait for any answer.Data residencyRules about which country data must be stored in.PartitionA separate group of AWS regions, like the main one, China, or US government.An everyday example: a supermarket chain
- A region is a city where the chain has its big warehouses - Mumbai, Singapore, Frankfurt.
- Availability zones are the separate warehouses in that city: if one has a fire or a power cut, the others keep working.
- Edge locations are the small corner shops in many more towns: they keep the popular items close to you, but for anything special they still order from the warehouse.
- You shop faster from a warehouse in your own city than from one on another continent - and some goods (like your data) may not legally leave the country.
Example 1 - the map of regions
boto3 ships AWS’s own list of regions. regions.py reads it - offline, no account:
- AWS groups regions into partitions. "aws" is the normal one, with 34 regions here.
- China, US government (GovCloud) and some secret-level partitions are separate worlds: separate accounts, cut off from the main one.
- Every region has a code and a name: ap-south-1 is Asia Pacific (Mumbai), ap-south-2 is Asia Pacific (Hyderabad).
- Read a code like this: ap = Asia Pacific, south = part of that area, 1 = the first region there.
from botocore.loaders import Loader
# botocore ships AWS's own list of regions - read offline, no account
partitions = Loader().load_data("endpoints")["partitions"]
for partition in partitions:
print(f"{partition['partition']:<12} {partition['partitionName']:<24} regions: {len(partition['regions'])}")
aws = next(p for p in partitions if p["partition"] == "aws")
print("\nAsia Pacific regions in the main 'aws' partition:")
for code, info in sorted(aws["regions"].items()):
if code.startswith("ap-"):
print(f" {code:<16} {info['description']}")aws AWS Standard regions: 34
aws-cn AWS China regions: 2
aws-us-gov AWS GovCloud (US) regions: 2
aws-iso AWS ISO (US) regions: 2
aws-iso-b AWS ISOB (US) regions: 2
aws-iso-e AWS ISOE (Europe) regions: 1
aws-iso-f AWS ISOF regions: 2
aws-eusc AWS EUSC regions: 1
Asia Pacific regions in the main 'aws' partition:
ap-east-1 Asia Pacific (Hong Kong)
ap-east-2 Asia Pacific (Taipei)
ap-northeast-1 Asia Pacific (Tokyo)
ap-northeast-2 Asia Pacific (Seoul)
ap-northeast-3 Asia Pacific (Osaka)
ap-south-1 Asia Pacific (Mumbai)
ap-south-2 Asia Pacific (Hyderabad)
ap-southeast-1 Asia Pacific (Singapore)
ap-southeast-2 Asia Pacific (Sydney)
ap-southeast-3 Asia Pacific (Jakarta)
ap-southeast-4 Asia Pacific (Melbourne)
ap-southeast-5 Asia Pacific (Malaysia)
ap-southeast-6 Asia Pacific (New Zealand)
ap-southeast-7 Asia Pacific (Thailand)Inside a region: availability zones
A region is not one building. It is split into availability zones:
- Each zone is one or more data centres with its own power, cooling and network.
- Zones in a region are kilometres apart - far enough that a fire, flood or power cut usually hits only one - but close enough to be connected by fast private links.
- Most regions have three or more zones. Their names add a letter to the region: ap-south-1a, ap-south-1b, ap-south-1c. Lesson 1’s server landed in ap-south-1a.
- Running your app in two or more zones lets it survive one zone going dark - Lesson 5 does exactly that.
Example 2 - distance is time
measure.py times real network round trips from a laptop in Hyderabad to six regions:
- It uses each region’s public DynamoDB health check, https://dynamodb.<region>.amazonaws.com/ping - it answers "healthy" without an account or a key.
- connect_ms(): just opening a connection = one round trip, the smallest wait possible.
- request_ms(): a full HTTPS request - connecting, setting up encryption (more round trips), asking and answering.
- Every number is the median of 5 rounds, so one slow moment does not decide the result.
- Then it prices a t3.medium in two regions from AWS’s public price lists (Lesson 1).
import json
import socket
import statistics
import time
import urllib.request
REGIONS = {
"ap-south-2": "Hyderabad",
"ap-south-1": "Mumbai",
"ap-southeast-1": "Singapore",
"eu-central-1": "Frankfurt",
"us-east-1": "N. Virginia",
"ap-southeast-2": "Sydney",
}
ROUNDS = 5
def connect_ms(host):
"""One network round trip: the time to open a TCP connection."""
start = time.perf_counter()
socket.create_connection((host, 443), timeout=5).close()
return (time.perf_counter() - start) * 1000
def request_ms(url):
"""A full HTTPS request: connect, encrypt, ask, answer."""
start = time.perf_counter()
urllib.request.urlopen(url, timeout=5).read()
return (time.perf_counter() - start) * 1000
print(f"from this laptop, median of {ROUNDS} rounds:")
results = {}
for region, city in REGIONS.items():
host = f"dynamodb.{region}.amazonaws.com" # a public health check: no account needed
connect = statistics.median(connect_ms(host) for _ in range(ROUNDS))
request = statistics.median(request_ms(f"https://{host}/ping") for _ in range(ROUNDS))
results[region] = request
print(f" {region:<15} {city:<12} round trip {connect:6.0f} ms one request {request:6.0f} ms")
# A shop page that makes 5 API calls, one after another
for region in ["ap-south-1", "us-east-1"]:
print(f"a page with 5 calls to {region:<11}: {5 * results[region]:5.0f} ms")
# The price side of the choice (real on-demand prices, public price lists)
price = {}
for region, file, name in [("ap-south-1", "mumbai.json", "Asia Pacific (Mumbai)"),
("us-east-1", "virginia.json", "US East (N. Virginia)")]:
rows = json.load(open(file))["regions"][name].values()
price[region] = float(next(r["price"] for r in rows if r["Instance Type"] == "t3.medium"))
print(f"t3.medium in {region:<11}: ${price[region]}/hour = ${price[region] * 720:.2f} per month")from this laptop, median of 5 rounds:
ap-south-2 Hyderabad round trip 8 ms one request 29 ms
ap-south-1 Mumbai round trip 22 ms one request 69 ms
ap-southeast-1 Singapore round trip 56 ms one request 164 ms
eu-central-1 Frankfurt round trip 147 ms one request 449 ms
us-east-1 N. Virginia round trip 216 ms one request 649 ms
ap-southeast-2 Sydney round trip 260 ms one request 772 ms
a page with 5 calls to ap-south-1 : 343 ms
a page with 5 calls to us-east-1 : 3246 ms
t3.medium in ap-south-1 : $0.0448/hour = $32.26 per month
t3.medium in us-east-1 : $0.0416/hour = $29.95 per monthReading the result
- The round trip grows with distance: 8 ms to Hyderabad, 22 ms to Mumbai, 216 ms to N. Virginia, 260 ms to Sydney. This is mostly the speed of light in fibre cables - no code can make it smaller.
- A full HTTPS request needs several round trips, so it costs about three times more: 69 ms from Mumbai, 649 ms from N. Virginia.
- Real pages make many calls one after another. 5 calls: 343 ms from Mumbai, 3,246 ms from N. Virginia - about 3 seconds slower, on every page.
- Your numbers will be different: they depend on where YOU are. That is the point - measure from where your users are.
Trap: choosing a region by price alone
us-east-1 (N. Virginia) is AWS’s oldest region, the default in many tutorials and tools - and often the cheapest. For a shop whose customers are in India:
- Before: us-east-1. The t3.medium costs $29.95 a month instead of $32.26 - a saving of $2.31 a month.
- Each page with 5 calls takes 3,246 ms. Customers wait over 3 seconds for every click.
- After: ap-south-1 (Mumbai), close to the customers: 343 ms for the same page.
- Choose the region by your users first, then by law, then by price. Lesson 4 adds the other questions (which services exist there, and what a second region costs).
Tip: A closer region is not always ready. Newer regions (like Hyderabad, ap-south-2) sometimes get new services later than older ones. Check that every service you need exists in a region before you choose it.
Example 3 - an edge location near you
aws.amazon.com is served by CloudFront, AWS’s CDN. CloudFront adds two headers to every answer. edge.py prints them for a page and an image:
- x-amz-cf-pop names the edge location that answered. HYD57 = an edge in Hyderabad (edge names start with a nearby airport code).
- x-cache says whether the edge already had the file: Hit (it did) or Miss (it had to fetch it from the origin, far away).
- The logo is a static file: Hit, 26-37 ms - served from Hyderabad without leaving the city.
- The home page is made fresh for each visit: always Miss, about 500 ms - the edge still had to ask the origin.
- So an edge location speeds up what can be cached - images, CSS, JavaScript, videos. Pages made per user still travel to the region. CloudFront in depth: Lesson 6 and Lesson 211.
import time
import urllib.request
# Both are served by CloudFront. The response headers say which edge location answered,
# and whether it had the file already (Hit) or had to fetch it from far away (Miss).
URLS = {
"home page (made fresh)": "https://aws.amazon.com/",
"logo image (static)": "https://a0.awsstatic.com/libra-css/images/logos/aws_logo_smile_1200x630.png",
}
for name, url in URLS.items():
for attempt in range(1, 4):
start = time.perf_counter()
with urllib.request.urlopen(url, timeout=10) as response:
response.read()
ms = (time.perf_counter() - start) * 1000
print(f"{name:<23} edge {response.headers['x-amz-cf-pop']:<9} "
f"{response.headers['x-cache']:<22} {ms:5.0f} ms")home page (made fresh) edge HYD57-P7 Miss from cloudfront 512 ms
home page (made fresh) edge HYD57-P7 Miss from cloudfront 500 ms
home page (made fresh) edge HYD57-P7 Miss from cloudfront 497 ms
logo image (static) edge HYD57-P7 Hit from cloudfront 37 ms
logo image (static) edge HYD57-P7 Hit from cloudfront 32 ms
logo image (static) edge HYD57-P7 Hit from cloudfront 26 msWhere your data lives - and why it matters
A resource you create in a region stays in that region. AWS does not copy it elsewhere unless you set that up:
- Law: some data must stay in a country. For example, India’s central bank (RBI) requires payment system data to be stored in India. Choosing ap-south-1 or ap-south-2 keeps it there.
- Safety: regions are independent of each other - AWS designs it so a big failure in one region does not spread to another. To survive losing a whole region, you copy data to a second region on purpose (disaster recovery, Lesson 184).
- Cost: moving data between regions or out to the internet is charged per gigabyte. Keep the parts of an app that talk a lot in the same region.
Global infrastructure at a glance
RegionWhere resources live.
ap-south-1 = Asia Pacific (Mumbai)
Availability zoneRegion + a letter.
ap-south-1a, ap-south-1b, ap-south-1c
Edge locationFrom the CloudFront header.
x-amz-cf-pop: HYD57-P7
Health checkNo account needed.
https://dynamodb.ap-south-1.amazonaws.com/ping
List regionsOffline, from botocore.
Loader().load_data("endpoints")["partitions"]Try it yourself
The code does not change. Swap the content string and the program does something else entirely.
“Run measure.py where you live. Which region is closest to you?”
“Add eu-west-2 (London) and sa-east-1 (São Paulo) to REGIONS. Where do they fit?”
“Run edge.py and read x-amz-cf-pop. Which city does its airport code stand for?”
“Find another website that uses CloudFront (look for an x-amz-cf-pop header) and compare its cache headers.”
What usually goes wrong
Saving $2.31 a month made each page about 3 seconds slower for users in India.
Tutorial defaults are not your users’ location.
Only cached files were fast (26-37 ms); the fresh home page still took about 500 ms.
Data stays in its region unless you copy it on purpose.
Some data must stay in the country - check before choosing.
Best practices
- Choose the region closest to most of your users, then check law and price.
- Measure latency from where your users are.
- Check that every service you need exists in the region.
- Plan for more than one availability zone from the start.
- Put static files behind CloudFront.
Practice
Write these yourself before opening anything. Getting them wrong first is most of how this sticks.
Extend measure.py: for each region, print the time for a page with 5 calls and the t3.medium monthly price (download the price lists you need, as in Lesson 1). Then print the region you would choose for users in your city if a page must load in under 500 ms, and why.
Show hintHide hint
The price-list file name changes with the region name in its URL, for example "Asia%20Pacific%20(Singapore)".
Pick a region for three shops
Three shops ask you where to run. Use your measurements and the rules in this lesson to choose a region for each, in writing.
- Shop 1: all customers in Hyderabad and Chennai, takes card payments.
- Shop 2: customers in India, Singapore and Malaysia, sells digital downloads.
- Shop 3: customers in Germany and France, keeps customer addresses.
- For each: the region, one number you measured (or would measure), and one rule (law, latency or price) that decided it.
Key points
- Regions are geographic areas; availability zones are separate data centres inside a region; edge locations sit near users.
- Distance is time: 8 ms to Hyderabad, 216 ms to N. Virginia, measured from Hyderabad.
- A 5-call page: 343 ms from Mumbai, 3,246 ms from N. Virginia.
- CloudFront answered from Hyderabad: cached files in 26-37 ms, fresh pages about 500 ms.
- Data stays in its region - choose by users, law, then price.
Quick check before you move on
Interview questions
Explain AWS global infrastructure.
Regions are isolated geographic areas; each has multiple availability zones - physically separate data centres with independent power and networking, linked by low-latency connections; edge locations (points of presence) cache content and serve DNS close to users.
How do you choose an AWS region?
By latency to users, data residency and compliance, service availability, and price - and for resilience, whether a second region is needed for disaster recovery.
What is the difference between an availability zone and an edge location?
An AZ is where your compute and data run, inside a region; an edge location is a smaller site near users that caches content (CloudFront) and answers DNS (Route 53).
Quiz
- 1.
Why did the full request take about three times as long as the round trip?
- 2.
Why was the home page a Miss every time while the logo was a Hit?
- 3.
What is the difference between a region and an availability zone?
- 4.
Name three things to weigh when choosing a region.
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...