AWS from zero · Part 1: Foundations · Lesson 1 of 38 · about 45 minutes

What AWS solves, and how the bill works

Where AWS runs, why businesses move to the cloud, what it costs them, and how the bill works, all from AWS's own public data and no account. A map of its 34 Regions and 109 Availability Zones, the October 2025 outage, a company that left AWS to save millions, and a month's bill for a small online shop, added up from 393,699 real prices. The biggest line wasn't the server. It was a network component doing almost nothing.

By the end you'll know

  • The difference between on-premises, colocation and cloud, and what IaaS, PaaS and SaaS mean
  • What Regions and Availability Zones are, and where AWS's are
  • Why businesses move to the cloud, what it costs them, and when owning hardware wins
  • The five ways AWS charges: time, storage over time, requests, data moving, and commitments
  • How to read AWS's published price lists, without an account
  • Why the expensive part of a bill is often something nobody thought about
  • What the free plan gives a new account, and when it ends

Before you start

  • You need: Python 3 and curl (both come with macOS and most Linux systems), and about 500 MB of download for the price list. No AWS account; that comes in Lesson 2.
  • Versions: AWS's Price List files as published on November 7, 2026, fetched November 8. Prices change; the scripts fetch whatever is current when you run them.
  • The example: Juniper & Rye, the made-up bakery from the Web development track, thinking about moving its online shop to AWS. Every run and line of output below is real.

The short version

  • AWS rents you computers, storage and finished building blocks, by the second, hour or gigabyte. You don't buy hardware, and you pay for what exists.
  • It runs in 34 Regions with 109 Availability Zones (as of November 2026), each zone its own data centres. Prices differ by Region: S3 storage costs 80% more in São Paulo than in the cheapest.
  • IaaS, PaaS and SaaS are how much you hand over: like renting an apartment, a serviced apartment, or a hotel room. More handed over means less to run and less control.
  • The cloud trades up-front cost for running cost, risk and complexity. It wins for small, spiky or uncertain workloads; large, steady ones can be cheaper on your own hardware.
  • Five meters make up every bill: time something exists, data stored over time, requests, data moving out, and discounts for committing.
  • Idle isn't free. A NAT gateway doing almost nothing cost $32.85 a month, 59% of the shop's $56.15 bill and more than twice its server.
  • Design beats discounts. Committing to the server for a year saved 8% of the bill; removing the NAT gateway saved 59%.
  • New accounts get a free plan: up to $200 in credits for at most 6 months. The shop as designed would use the credits up in 3.6 months.

Where your software runs: three choices

Juniper & Rye's shop runs on one rented server today. Every website runs on a computer somewhere, in a data centre: a building full of servers, with power, cooling, network connections and security staff. A business has three ways to get space in one:

On-premisesColocationCloud
Who owns the buildingYouA data centre companyThe cloud provider
Who owns the serversYouYouThe provider; you rent time on them
Who replaces a failed diskYour staffYour staff, or paid "remote hands"The provider
How you payUp front, then running costsUp front for servers, monthly for space and powerBy the second, hour or gigabyte
Time to add a serverWeeks, to order and installWeeksMinutes

Amazon Web Services (AWS) is the third column, and the largest cloud provider. The rest of this lesson is about what that buys you, what it costs you, and how the bill works.

An analogy: places to live

Think of hosting software like finding somewhere to live. There are five common ways, and each one hands one more job to someone else:

Place to liveCloud termYou still handleAWS examples
Build your own houseOn-premisesEverything: the land, the building, the roof, the plumbing, the furnitureNone
Your own house on a rented lotColocationThe house and everything in it; the lot owner provides the land, power and waterNone
Rent an apartmentIaaS, infrastructure as a serviceFurnishing it, keeping it running inside, locking the door; the landlord keeps the building standingEC2, VPC, EBS; Lightsail is a simpler version
Rent a serviced apartmentPaaS, platform as a serviceBringing your things and living there; furniture, cleaning and repairs are done for youElastic Beanstalk, Lambda, Amplify Hosting
Stay in a hotelSaaS, software as a serviceJust staying; you can't repaint the roomNot AWS's main business; think Gmail, or Shopify for an online shop

In the cloud, "your things" are your code and data, and "the building" is the servers, networks and data centres under them. Four things the analogy gets right:

  • Each step down trades control for convenience. In your own house you can knock down a wall. In an apartment (IaaS) you can arrange everything inside but not move the walls. In a serviced apartment (PaaS) you don't choose the furniture. In a hotel (SaaS) you take the room as it is.
  • Rent is due whether you're home or not. An apartment costs the same if you're away all month. Cloud resources that bill by the hour work the same way, and that's the most important idea in this lesson's bill.
  • Security is shared, and the line moves. The landlord fixes the front door; locking your own door is your job. How much is yours depends on the row: that's Lesson 5's shared responsibility.
  • Real setups mix them. The bakery's shop below uses a rented server (an apartment), S3, a storage service AWS runs entirely (closer to serviced), and might take payments through a SaaS provider (a hotel). The question isn't which one, it's which one for each job.

The analogy even stretches to the next section: a whole neighbourhood can flood, which is why sensible people don't keep everything in one place. AWS spreads its data centres the same way.

Where AWS runs: Regions and Availability Zones

AWS groups its data centres in two levels:

  • An Availability Zone (AZ) is one or more data centres with their own power, cooling and networking, close enough to its neighbours for fast connections, far enough apart that a fire, flood or power cut in one shouldn't take out another.
  • A Region is a geographic area with several Availability Zones. AWS's documentation says every Region has at least three, and that Regions are designed to be isolated from each other. What you create stays in the Region you created it in; AWS doesn't copy it anywhere else unless you ask.

Each Region has a code, like us-east-1 for US East (N. Virginia), and its zones add a letter: us-east-1a, us-east-1b and so on.

regions.py, in the practice folder, builds the list from two public sources: the Regions in AWS's S3 price list, with each one's storage price, and the Availability Zone table in AWS's documentation. Like everything in this lesson, it needs no account.

(Your machine)

BASH
cd lesson-01
python3 regions.py

The output lists 40 entries. The 34 that are Regions, with their zones and S3 prices:

OUTPUT
Region           Name in the price list            AZs  S3 $/GB-month
af-south-1       Africa (Cape Town)                  3        $0.0274
ap-east-1        Asia Pacific (Hong Kong)            3         $0.025
ap-east-2        Asia Pacific (Taipei)               3        $0.0225
ap-northeast-1   Asia Pacific (Tokyo)                4         $0.025
ap-northeast-2   Asia Pacific (Seoul)                4         $0.025
ap-northeast-3   Asia Pacific (Osaka)                3         $0.025
ap-south-1       Asia Pacific (Mumbai)               3         $0.025
ap-south-2       Asia Pacific (Hyderabad)            3         $0.025
ap-southeast-1   Asia Pacific (Singapore)            3         $0.025
ap-southeast-2   Asia Pacific (Sydney)               3         $0.025
ap-southeast-3   Asia Pacific (Jakarta)              3         $0.025
ap-southeast-4   Asia Pacific (Melbourne)            3         $0.025
ap-southeast-5   Asia Pacific (Malaysia)             3        $0.0225
ap-southeast-6   Asia Pacific (New Zealand)          3       $0.02625
ap-southeast-7   Asia Pacific (Thailand)             3        $0.0225
ca-central-1     Canada (Central)                    3         $0.025
ca-west-1        Canada West (Calgary)               3         $0.025
eu-central-1     EU (Frankfurt)                      3        $0.0245
eu-central-2     Europe (Zurich)                     3       $0.02695
eu-north-1       EU (Stockholm)                      3         $0.023
eu-south-1       EU (Milan)                          3         $0.024
eu-south-2       Europe (Spain)                      3         $0.023
eu-west-1        EU (Ireland)                        3         $0.023
eu-west-2        EU (London)                         4         $0.024
eu-west-3        EU (Paris)                          3         $0.024
il-central-1     Israel (Tel Aviv)                   3         $0.025
me-central-1     Middle East (UAE)                   3         $0.025
me-south-1       Middle East (Bahrain)               3         $0.025
mx-central-1     Mexico (Central)                    3       $0.02415
sa-east-1        South America (Sao Paulo)           3        $0.0405
us-east-1        US East (N. Virginia)             6+1         $0.023
us-east-2        US East (Ohio)                      3         $0.023
us-west-1        US West (N. California)             3         $0.026
us-west-2        US West (Oregon)                    4         $0.023

and the summary at the end:

OUTPUT
Regions with Availability Zones in AWS's table: 34, with 109 zones (and 1 announced)
In the price list but not the zone table: ap-southeast-1-han-1, aws-other, eu-central-1-ath-1, eu-central-1-ist-1, us-gov-east-1, us-gov-west-1
S3 storage: cheapest ap-east-2 at $0.0225, dearest sa-east-1 at $0.0405 (+80%)

What the list shows:

  • 34 Regions and 109 Availability Zones. Most Regions have 3 zones. us-east-1, the oldest and busiest, has 6, and AWS's table lists a seventh, in Maryland, as coming in 2026. That's the 6+1.
  • The six entries without zones aren't ordinary Regions. us-gov-east-1 and us-gov-west-1 are GovCloud, isolated Regions for US government work, used through separate accounts. The three with a city code on the end are Local Zones: small extensions of a Region placed closer to users in another city. AWS opened the Hanoi one (han) in June 2026 and Athens (ath) in July; ist is Istanbul. aws-other isn't a place at all, just a price-list entry.
  • Regions in mainland China aren't listed at all. They're run separately, with their own accounts and price lists.
  • Prices vary by Region. S3 storage costs $0.0225 per GB-month in Taipei, Malaysia and Thailand and $0.0405 in São Paulo, 80% more. Other prices, servers included, vary by Region too.
AWS's Regions, sized by their Availability Zones. Positions are approximate: each dot is at the area the Region is named for. Select the map to enlarge it.

Choosing a Region comes down to four things, in roughly this order: where your users are (closer is faster), what the law says about where data must stay, which services you need (new services often launch in the biggest Regions first), and price. Lesson 5 makes that choice for the bakery in a real account; Part 2 spreads a site across zones so one failing doesn't take it down.

Why businesses move to the cloud

  • No up-front cost. You pay as you use, from the first second. A server for 10 minutes costs 10 minutes' worth, and there's no hardware to buy, depreciate or dispose of.
  • Room to grow and shrink. More servers in minutes for December, fewer in January. This is usually called elasticity, and it means you stop paying for the capacity you guessed you'd need.
  • Speed. Trying an idea takes an afternoon, not a purchase order. Failed experiments cost a few dollars, not a rack of servers.
  • Finished building blocks. Instead of installing and running a database, file storage or a queue yourself, you rent one that AWS runs, patches and backs up. These are managed services, and they're most of what AWS sells.
  • Resilience you couldn't build alone. Spreading a site across three Availability Zones, each its own set of data centres, is a setting. Doing that yourself means three buildings.
  • Reach. The same services on six continents, so you can run close to your customers.

What it costs you: the downsides

  • Bills are hard to predict. You saw why: hundreds of thousands of prices, and things that charge by the hour whether they're busy or not. Without budgets and regular checks, surprises are normal. This lesson's bakery is an example.
  • Outages happen, and they can be big. On October 20, 2025, a bug in the automation that manages DNS (the internet's address lookup) for DynamoDB, AWS's NoSQL database, took DynamoDB down in us-east-1. Because so much of AWS depends on it, launching servers in EC2, running Lambda functions and starting containers failed too, for many customers, over about 14.5 hours. AWS's own write-up is in Go deeper. Designing across zones helps; surviving a whole Region failing takes much more work and money.
  • Lock-in. The more AWS-specific services you use, the harder it is to move. Since March 2024, AWS waives the data transfer fees for moving your data out, if you ask AWS Support. Rewriting your software to work without AWS's services is the expensive part, and that's never waived.
  • You're still responsible for a lot. AWS secures its data centres; what you build and who can reach it is your job (Lesson 5). Most cloud security problems in the news come from settings customers chose, like storage left open to the public, not from break-ins at AWS.
  • It takes skills. A cloud setup has more moving parts than one server, and someone has to understand them. That's what this track is for.
  • Where data lives matters. Some laws require data to stay in a country or region. AWS has Regions in many, but not all.

When your own hardware wins

The cloud is cheapest when usage is spiky, uncertain or small. For a large, steady, predictable workload with a team that can run hardware, owning can cost less.

37signals, the company behind Basecamp and HEY, is the best-known example. It first moved its servers off AWS, onto about $700,000 of its own hardware, then moved its stored files from S3 to about $1.5 million of storage arrays, with AWS waiving $250,000 of data transfer fees. The company said its yearly infrastructure bill would fall from about $3.2 million to well under $1 million, without hiring more staff.

The same arithmetic doesn't work for Juniper & Rye. Its whole AWS bill, below, is about $56 a month; at that size there's little to save by owning hardware, and a lot of work in running it. The question to ask is the same either way: what does it cost, all in, including people, to run it each way? The rest of this lesson is how to answer the cloud half of that.

What you can build with it

The track works through the main building blocks in this order:

KindExamplesIn this track
Accounts and accessIAM (Identity and Access Management), OrganizationsParts 1 and 6
NetworkingVPC (Virtual Private Cloud), load balancers, Route 53Part 2
ServersEC2 (Elastic Compute Cloud)Part 2
Storage and databasesS3 (Simple Storage Service), EBS (Elastic Block Store), RDS (Relational Database Service), DynamoDBPart 3
Code without serversLambda, API Gateway, queues and eventsPart 4
Containers and infrastructure as codeECS, EKS, Terraform, CloudFormationPart 5
Watching, securing and payingCloudWatch, CloudTrail, KMS, Cost ExplorerPart 6

How AWS charges: five meters

Every line on an AWS bill is one of these:

MeterYou pay forExamples in this lesson
TimeEach hour, or second, that something exists or runsA server, a NAT gateway, a public IP address
Storage over timeHow much you keep, for how long: a GB-month is one gigabyte kept for a monthA server's disk, photos in S3
RequestsEach operation, usually priced per thousand or per millionUploading and downloading files in S3
Data movingGigabytes leaving AWS for the internet, or crossing some boundaries inside it; data coming in is usually freeVisitors downloading pages and photos
CommitmentsA lower rate in exchange for promising to use something for 1 or 3 yearsA server on a 1-year commitment

The first row holds the most important rule in this track: you pay for things while they exist, not while they're busy. A server is billed for every second it runs, whether it serves a thousand visitors or none. Most Linux servers are billed by the second, with a 60-second minimum; a stopped server isn't billed, but its disk is, because disks are priced as "provisioned storage", space set aside for you whether or not it holds anything.

AWS's price lists

AWS publishes every price as files anyone can download, with no account: the Price List bulk API (API, application programming interface, here just meaning files with a fixed address and format) at pricing.us-east-1.amazonaws.com. There's one file per service per Region.

The first surprise is their size. A short check of the files for US East (N. Virginia), Region code us-east-1 (probe.py in the practice folder), found:

OUTPUT
AmazonEC2: us-east-1 file 481.6 MB  /offers/v1.0/aws/AmazonEC2/20261107002852/us-east-1/index.json
AmazonRDS: us-east-1 file 30.9 MB  /offers/v1.0/aws/AmazonRDS/20261029070635/us-east-1/index.json
AmazonS3: us-east-1 file 0.5 MB  /offers/v1.0/aws/AmazonS3/20261104174445/us-east-1/index.json

Nearly half a gigabyte, for the price of servers in one Region. That's every server type, operating system, licence, tenancy, discount plan and add-on, each a separate price. It's the best single picture of why AWS bills are hard to predict.

The practice folder, lesson-01, has fetch-prices.py. It reads the price lists this lesson needs and saves the handful of prices it uses to prices.json:

  • EC2, streamed as CSV (comma-separated values) row by row, keeping only four server types, NAT gateways and gp3 disks. Reading the half-gigabyte file a line at a time means it never has to fit in memory.
  • VPC for public IPv4 addresses, S3 in five Regions, and data transfer out to the internet, each small enough to read whole.
  • Downloads go through curl, which uses your operating system's trusted certificates. (On a Mac, Python from python.org needs a separate certificate setup before it can download over HTTPS; using curl avoids that.)

(Your machine)

BASH
cd lesson-01
python3 fetch-prices.py
OUTPUT
Streaming the EC2 price list for us-east-1 (large; this takes a few minutes)...
  read 393,699 price rows

EC2 price list published 2026-11-07, us-east-1, Linux
  Server      vCPU  memory    on demand   1-yr commitment
  t4g.small      2   2 GiB    $0.0168/h    $0.0105/h (-37%)
  t4g.medium     2   4 GiB    $0.0336/h    $0.0211/h (-37%)
  t3.small       2   2 GiB    $0.0208/h     $0.013/h (-38%)
  m8g.large      2   8 GiB   $0.08976/h   $0.05938/h (-34%)
  NAT gateway: $0.045 per hour it exists, plus $0.045 per GB through it
  gp3 disk: $0.08 per GB-month
Public IPv4 address: $0.005 per hour in use, $0.005 per hour idle
S3 Standard, per GB-month for the first 50 TB, and per request:
  us-east-1       $0.023    upload $0.000005   download $0.0000004
  us-west-2       $0.023    upload $0.000005   download $0.0000004
  eu-west-1       $0.023    upload $0.000005   download $0.0000004
  ap-southeast-2  $0.025    upload $0.0000055  download $0.00000044
  sa-east-1       $0.0405   upload $0.000007   download $0.00000056
Data out to the internet from us-east-1, per GB: up to 10 TB $0.09, up to 50 TB $0.085, up to 150 TB $0.07, beyond that $0.05
Saved prices.json

How to read it:

  • Servers are named family, generation, options and size. t4g.small is the t family (small, inexpensive, for work that's mostly quiet), generation 4, g for Graviton, AWS's own ARM processors, size small. t3.small is the same size on an Intel processor, and costs 24% more.
  • "On demand" is the normal price, by the hour, no promises. "1-yr commitment" here is a Reserved Instance with no up-front payment: promise a year, pay about a third less, and pay for the whole year even if you stop using it.
  • A NAT gateway has two meters: an hourly charge for existing, and a charge for each GB that goes through it. Remember the first one.
  • A public IPv4 address costs $0.005 an hour, in use or not. AWS started charging for every public IPv4 address on February 1, 2024, because there aren't enough of them left in the world. That's about $3.65 a month each.
  • S3 storage is the same price in three of the five Regions, 9% more in Sydney and 76% more in São Paulo. Region matters for price, as well as for distance to customers.
  • Data out is tiered: the more you send in a month, the less each GB costs. The price list's description calls it "beyond the global free tier": the first 100 GB a month to the internet is free, across all of AWS.

A month for the bakery

Juniper & Rye's plan for AWS, sketched by someone who read a tutorial:

  • A web server (t4g.small) with a 20 GB disk and a public IPv4 address, so customers can reach it.
  • A NAT gateway. The tutorial put the shop's order database on a second server in a private subnet, a part of the network the internet can't reach, which is good. That server still needs to download updates, and a NAT gateway (network address translation) is AWS's managed way to let private servers reach out to the internet without letting the internet reach in. The database server itself is left out of this bill to keep it short.
  • 30 GB of product photos in S3, downloaded 300,000 times a month, with 5,000 new uploads.
  • 150 GB a month of pages and photos sent to visitors.

bill.py adds this up from prices.json. It contacts nothing; it's arithmetic on the prices you just downloaded. A month is 730 hours, the figure AWS's own estimates use (8,760 hours in a year, divided by 12). Its core is one list of lines, each a description, the meter, and the cost:

PYTHON
("NAT gateway, existing", f"{HOURS} h x {usd(nat_hr)}", HOURS * nat_hr),
("NAT gateway, 10 GB through it", f"10 GB x {usd(nat_gb)}", 10 * nat_gb),

and a function, tiered, that charges an amount against tiered prices like data out, lowest tier first.

(Your machine)

BASH
python3 bill.py
OUTPUT
Prices: AWS Price List, us-east-1 unless stated, fetched 2026-11-08

1. Juniper & Rye's shop, one month
  Web server, t4g.small              730 h x $0.0168                $   12.26   22%
  Its disk, 20 GB gp3                20 GB-month x $0.08            $    1.60    3%
  Its public IPv4 address            730 h x $0.005                 $    3.65    7%
  NAT gateway, existing              730 h x $0.045                 $   32.85   59%
  NAT gateway, 10 GB through it      10 GB x $0.045                 $    0.45    1%
  Photos in S3, 30 GB                30 GB-month x $0.023           $    0.69    1%
  S3 downloads, 300,000              300,000 x $0.0000004           $    0.12    0%
  S3 uploads, 5,000                  5,000 x $0.000005              $    0.03    0%
  Data out to visitors, 150 GB       (150 - 100 free) GB, tiered    $    4.50    8%
  Total                                                             $   56.15

The NAT gateway is 59% of the bill. It moved 10 GB in the month, which cost 45 cents. The other $32.85 is for existing: 730 hours at $0.045. It costs more than twice the web server that actually runs the shop.

Nobody chose to spend $32.85 a month on this. The tutorial included it because private subnets usually need one, and nothing in the console says "this will be the biggest line on your bill". This is the most common shape of an AWS surprise: not a big decision, but a small, sensible-looking component that bills every hour.

The rest is cheap in comparison. 300,000 S3 downloads cost 12 cents. The first 100 GB to visitors was free, so 150 GB cost $4.50.

Things left running

The same month, with three things that happen in every real account: a test server someone forgot, its disk, and an Elastic IP (a fixed public address you reserve) left over after the test server it belonged to was rebuilt.

OUTPUT
2. Things left running by mistake, added to that month
  Test server, t4g.medium, forgotten 730 h x $0.0336                $   24.53
  Its disk, 30 GB gp3                30 GB-month x $0.08            $    2.40
  An unattached address (Elastic IP) 730 h x $0.005                 $    3.65
  Total with the mistakes                                           $   86.73

Up 54%, for things nobody is using. The unattached address costs exactly what an address in use does. AWS doesn't send a bill for this until the end of the month, so the defences have to be set up first: a budget alarm that emails you when spending passes a limit (Lesson 2), and tags that say who made each thing and why (Part 6).

Changing one choice at a time

OUTPUT
3. Changing one choice at a time
  Same shop                                               per month   change
  as above                                                   $56.15      +0%
  server on a 1-year commitment                              $51.55      -8%
  no NAT gateway                                             $22.85     -59%
  server t3.small (Intel) instead of t4g.small               $59.07      +5%
  server m8g.large instead of t4g.small                     $109.41     +95%
  photos in S3 in sa-east-1 (Sao Paulo)                      $56.73      +1%
  • The 1-year commitment saved 37% on the server, and 8% of the bill, because the server was only 22% of it. Discounts apply to one line; design applies to the whole bill.
  • Removing the NAT gateway saved 59%. There are cheaper ways to let a private server get updates (Lesson 8 compares them), and sometimes the right answer is not to have a private server at all. Either way it's a design decision, and it beat every discount here.
  • Graviton was 5% cheaper overall than the same size on Intel, for software that runs on ARM processors, which most web software does.
  • A bigger server nearly doubled the bill. Picking a size "to be safe" is expensive; start small and measure (CloudWatch, Part 6).
  • Moving the photos to São Paulo added 1%. S3 storage cost 76% more there, but storage was a tiny part of this bill. A percentage only matters as much as the line it applies to.
OUTPUT
4. Paid by the second: a test server for 10 minutes
  t4g.small  $0.0168/h x 10/60 h = $0.0028
  m8g.large  $0.08976/h x 10/60 h = $0.0150

A third of a cent, and one and a half cents. Trying things on AWS is cheap, as long as you turn them off. The same m8g.large left on by mistake is $65.52 a month (730 hours at $0.08976). Every lab in this track ends by deleting what it made, and checking that it's gone.

The free plan

Since July 2025, a new AWS account can start on a free plan: $100 in credits at sign-up, and up to $100 more for trying certain services. The plan ends after 6 months, or when the credits run out, whichever comes first. Nothing is charged on the free plan; when it ends, AWS suspends the account, keeps your data for 90 days in case you upgrade to a paid plan, and then deletes the account. AWS says most new customers don't need to add a payment method to sign up. Some services aren't available on the free plan, mainly ones that would use the credits up quickly.

OUTPUT
5. On the free plan: $200 of credits, and the plan ends after 6 months at most
  the shop                           $ 56.15/month: credits run out after 3.6 months
  the shop with the mistakes         $ 86.73/month: credits run out after 2.3 months
  the shop without a NAT gateway     $ 22.85/month: the 6 months end first, $62.91 unused

(This assumes the credits apply to every line; check which services your plan covers before relying on it.) The same idle NAT gateway that dominated the bill is the difference between credits lasting the whole 6 months and running out in three and a half. Credits are for learning and testing, and they end. Plan for the paid bill from the start.

One month of the shop, line by line, and what each single change did. Select the chart to enlarge it.

Where you see the real bill

Everything above is arithmetic on published prices. With an account, AWS shows what you actually spent, in Billing and Cost Management in the console:

  • Bills: each month's charges, by service and Region, down to the usage types you saw in the price lists (NatGateway-Hours is a real line on real bills).
  • Cost Explorer: charts of spending over time, grouped by service, Region or tag.
  • Budgets: limits that email you when actual or forecast spending passes them. Lesson 2 creates one before anything else.
  • Free plan credits: how much is left, and when the plan ends.

None of these stop spending on their own by default. They tell you. Turning things off is still your job, which is why every lab here ends with cleanup.

In real systems

  • Estimate before you build. The AWS Pricing Calculator (in Go deeper) does what bill.py does, for any service. Ten minutes with it would have shown the NAT gateway line before anyone built it.
  • Look for things that bill by the hour. NAT gateways, load balancers, public IPv4 addresses, managed databases and servers all charge for existing. Count how many of each you have, and how many Availability Zones they're repeated in.
  • Data transfer is the line people don't model. Data out to the internet, and between Availability Zones and Regions, adds up with traffic. CloudFront (Lesson 14) has its own free allowance of 1 TB a month out to the internet.
  • Check whether you need all of this. For a site this small, Lightsail (Lesson 7) sells a server, its disk, a public address and a monthly data allowance for one fixed price. Compare it before building the EC2 version.
  • Commit only to what's steady. Reserved Instances and Savings Plans save a third or more, but you pay whether or not you use them. Commit to the baseline you've measured, not the peak you expect.
  • Tag everything with an owner and a purpose, from the first resource. "Whose is this?" is the question every cleanup starts with.

Spot the problem

Work out what's wrong before you read the explanation.

"The test environment costs more than production, and nobody uses it." A team copies its production network design into a test account: a VPC across three Availability Zones, each with a NAT gateway, plus a load balancer. The test servers are stopped most of the week to save money. The test account's bill is still about $100 a month before any servers run. What's wrong? Stopping servers doesn't stop the things that bill for existing. Three NAT gateways at this lesson's price are $98.55 a month (3 x 730 hours x $0.045) whether any traffic flows or not, and a load balancer and public addresses add more. The fix: give test environments a cheaper design, one NAT gateway or none, and delete hourly components when the environment isn't in use, which infrastructure as code (Part 5) makes easy to recreate. Then check: does the test account's bill drop close to zero in a week when nothing runs?

Keep this

ItemMeterPricePer month, always on
Server, t4g.smallTime$0.0168 an hour$12.26
NAT gatewayTime, plus data$0.045 an hour, plus $0.045 a GB$32.85 before any data
Public IPv4 addressTime$0.005 an hour, in use or idle$3.65
Disk, gp3Storage over time$0.08 per GB-month$1.60 for 20 GB
S3 StandardStorage, requests$0.023 per GB-month; $0.0000004 a download$0.69 for 30 GB
Data out to the internetData movingFirst 100 GB free, then $0.09 a GB$4.50 for 150 GB
AlwaysCount what bills by the hour; set a budget alarm first; delete what you made

Where you are now

You know the difference between owning, renting space and renting from a cloud; where AWS's Regions and Availability Zones are; what the cloud buys a business and what it costs, in money, risk and lock-in. You know the five meters behind every bill, how to read AWS's published prices without an account, and why an idle component can cost more than the server that does the work. You've seen that design choices move a bill more than discounts, and what the free plan gives a new account. The next lesson creates that account, safely: locking away the root user, turning on multi-factor authentication, and setting a budget alarm before anything is built.

Check yourself

  1. The bakery hands its code to a service that runs it, without managing any servers. Which model is that?

  2. What is an Availability Zone?

  3. A company wants to leave AWS. What does AWS waive, if asked, since March 2024?

  4. What was the largest line on the shop's monthly bill?

  5. A server is stopped. What still costs money?

  6. The 1-year commitment cut the server's price by 37%. How much did it cut the whole bill?

  7. What does an Elastic IP address cost when it isn't attached to anything?

  8. Why did moving the photos to Sao Paulo add only 1%?

  9. On the free plan, how long would $200 of credits last for the shop as designed?

Key terms

  • AWS (Amazon Web Services): Amazon's cloud: computers, storage, networks and managed services, rented by use.
  • Data centre: a building of servers with power, cooling, networking and security.
  • On-premises and colocation: running your own servers in your own building, or in space rented from a data centre company.
  • Availability Zone (AZ): one or more data centres with independent power and networking; every Region has at least three.
  • Local Zone: a small extension of a Region in another city, closer to users there.
  • IaaS, PaaS and SaaS (infrastructure, platform and software as a service): renting servers and networks you run yourself; handing over your code for a provider to run; using finished software someone else runs entirely.
  • Lock-in: how hard and costly it is to move away from a provider once you depend on its services.
  • Managed service: a building block, like a database or queue, that AWS runs for you.
  • Region: a geographic area with several Availability Zones, like US East (N. Virginia), code us-east-1. Regions are isolated from each other, and prices can differ between them.
  • On demand: the standard price, with no commitment.
  • Reserved Instance and Savings Plan: lower prices in exchange for committing to 1 or 3 years of use.
  • GB-month: one gigabyte stored for a month; how storage is priced.
  • Data transfer out: data leaving AWS for the internet, charged per GB after a free 100 GB a month.
  • Public IPv4 address and Elastic IP: an address reachable from the internet; an Elastic IP is one you reserve and can move between servers. Both cost $0.005 an hour.
  • Private subnet: part of a network the internet can't reach directly.
  • NAT gateway (network address translation gateway): a managed service that lets servers in a private subnet reach the internet, without letting the internet reach them. Charged by the hour and by the GB.
  • Price List bulk API: AWS's published price files, readable without an account.
  • Free plan: a new account's first months: up to $200 in credits, for at most 6 months.

Go deeper