Laptop to Production

What the cloud is

Renting computers by the second, and what that changes.

Time
25 minutes
Level
Beginner
Read first
Nothing — you can start here

Part 1: The problem

QuickCart, before the cloud

QuickCart’s first real server sat in a cupboard in Noor’s flat. It was fine on a normal Tuesday.

Then a food writer mentioned the app, and at 7pm on Friday ten times the usual number of people tried to order. The server ran out of memory and stopped answering. By the time Noor had restarted it, the rush was over, and so were a few hundred orders.

Buying a second server would take two weeks to arrive. And once it did, it would sit idle every day except the busiest hour of the busiest evening.

QuickCart’s problem isn’t one server. It’s that owning servers means guessing, in advance, how much you’ll ever need, then paying for that guess every hour of every day.

This lesson is about what the cloud really is, who is responsible for what, and how to keep an eye on the bill from the first day.

Part 2: The idea

The cloud is renting computers from someone else, by the second, instead of buying them. The computers sit in the provider’s buildings. You start them, use them and delete them from a web page or a command, and you pay only while they exist.

This course uses AWS, Amazon Web Services, the largest cloud provider. Google Cloud and Microsoft Azure work the same way under different names.

What changes when you rent

Owning serversRenting from the cloud
Getting a new serverOrder it, wait days or weeks, install itA minute or two
PayingUp front, for the most you’ll ever needPer second or per hour, for what exists right now
A quiet nightYou still pay for every serverYou can run fewer and pay less
A sudden rushYou’re stuck with what you boughtStart more, then remove them afterwards
A broken diskYour problem, at 3amThe provider replaces the hardware
Forgetting somethingIt’s already paid forIt keeps costing money until you delete it

Most AWS servers running Linux are billed per second, with a minimum of 60 seconds each time one starts. Other services charge per hour, per gigabyte stored or per request. Prices change and differ by region, so this course gives rough figures and always says so.

Key point: In the cloud you pay for what exists, not what you use it for. Delete what you don’t need.

Regions: where the computers are

AWS runs its computers in regions: separate groups of data centres in different parts of the world, such as us-east-1 in Northern Virginia or eu-west-2 in London. There are more than 30.

You choose a region for almost everything you create, and each region is independent. A server in us-east-1 doesn’t appear in the list for London. Regions and zones explains why QuickCart uses two buildings inside one region.

A few services aren’t tied to a region: they’re global. IAM, which controls who can do what, is the one you’ll meet first.

Services: the pieces you rent

AWS has hundreds of services. This course uses about fifteen. These are the ones you’ll meet first:

ServiceWhat it isQuickCart uses it for
IAMUsers, roles and permissionsDeciding who and what can change anything
VPCYour own private networkKeeping the database off the internet
EC2Virtual serversRunning the API
Elastic Load BalancingOne address in front of many serversSharing orders across servers
RDSManaged databasesStoring every order
S3Storage for filesMenu photos and receipts
CloudWatchLogs, metrics and alarmsKnowing when something breaks
Route 53DNS, for domain namesPointing example.com at the load balancer

Who is responsible for what

Renting a server doesn’t mean AWS looks after everything on it. AWS calls the split the shared responsibility model: AWS is responsible for the security of the cloud, and you’re responsible for security in the cloud.

AWS looks afterYou look after
The buildings, guards and powerWho can log in to your account, and with what permissions
The physical servers, disks and network cablesWhich traffic your network rules let in
The software that splits one physical machine into many virtual onesUpdating the operating system on your servers
Keeping managed services such as RDS runningYour app’s code and its secrets
Replacing broken hardwareEncrypting and backing up your data, using the tools AWS provides

The more managed a service is, the more AWS takes on. With EC2 you patch the operating system. With RDS, AWS patches the database software, but who can connect is still up to you.

A database left open to the internet is never AWS’s fault. The setting was yours.

Keeping the bill under control

The cloud’s biggest strength, paying for what exists, is also how people get surprised. Three habits prevent almost every surprise:

HabitWhat it means
A budget from day oneAWS Budgets emails you when spending crosses a limit you set, or is forecast to
Tags on everythingA label like Project = quickcart on each resource, so you can see what costs what
Clean up after every labEvery lab in this course ends with a clean-up step. Do it, every time

Part 3: See it

Below is one day of QuickCart orders, as the number of servers needed each hour. The dashed line is how many servers QuickCart owns. Pick a day and a number of servers, then play the day and compare owning with renting.

A day of orders
Servers you own
A bar chart of how many servers QuickCart needs in each hour of one day, with a dashed line showing how many servers it owns. Space between a bar and the line is capacity paid for but unused. Any part of a bar above the line is orders turned away.0481216Servers needed00:0003:0006:0009:0012:0015:0018:0021:00you own 4usedowned but idleorders turned away

Own 4 servers

$230 a month

24 idle server-hours a day

0 orders turned away a day

Rent what each hour needs

$216 a month

0 idle server-hours

0 orders turned away

Illustrative prices: an owned server works out at $0.08 an hour over its life; a rented one costs $0.10 an hour. Each server handles 100 orders an hour. A month is 30 days like this one.

ReadyPick a day and how many servers you own. Then choose Play the day.

What to notice: on the rush days there’s no good number to own. Own few and you turn orders away at dinner; own many and most of them sit idle and paid for, all day. Renting follows the bars. Owning only wins when the load is flat and predictable.

Part 4: Do it

Free — looking around the console and creating a budget that emails you costs nothing.

You’ll find the four things you’ll use in every lab: the region selector, your account ID, the billing pages, and a budget that warns you before a surprise. About 15 minutes.

You need an AWS account you can sign in to. If you’re signing in as the root user, the email address the account was created with, that’s fine for this lab only. Who can do what: IAM shows why you should stop using it straight afterwards.

  1. Find the region selector

    Sign in to the AWS console. Look at the top right of the page, next to your account name.

    You should see

    A region name such as N. Virginia or Ireland. Open it: a list of regions with their codes, like US East (N. Virginia) us-east-1.

    Choose US East (N. Virginia) us-east-1. This course uses it for every lab.

    Now type IAM in the search bar at the top and open it.

    You should see

    The region selector now says Global and can’t be changed. IAM is one of the few services that isn’t tied to a region.

  2. Find your account ID

    Choose your account name at the top right of the console.

    You should see

    A menu showing Account ID, a 12-digit number with a copy button. In this course it’s always shown as 111122223333. Wherever you see that, use your own.

    Copy it somewhere handy. You’ll need it for bucket names and permissions later. An account ID isn’t a secret on its own, but there’s no reason to post it publicly either.

  3. Open the billing home page

    In the AWS console: Billing and Cost ManagementHome

    You should see

    A summary of this month’s costs so far, a forecast for the month, and your costs broken down by service. In a new account, everything is $0.00 or close to it.

    Now open Free Tier in the left menu of the same page.

    You should see

    What your account can use for free, and how much of it you’ve used this month. What’s free depends on when your account was created and changes over time, so check here rather than relying on any list you read elsewhere, including this one.

  4. Create a budget that emails you

    In the AWS console: Billing and Cost ManagementBudgetsCreate budget

    FieldEnter
    Budget setupUse a template (simplified)
    TemplatesMonthly cost budget
    Budget namequickcart-monthly
    Enter your budgeted amount ($)10.00, or whatever you’re comfortable spending on this course each month
    Email recipientsyour own email address

    Choose Create budget.

    You should see

    quickcart-monthly in the list of budgets. The template sets up three alerts for you: when actual spending reaches 85% and 100% of the amount, and when the forecast for the month is going to pass 100%.

    If you’d rather hear about the very first cent, choose the Zero spend budget template instead. It emails you as soon as anything costs money.

    A budget that only sends email is free. AWS charges only for large numbers of budgets, or ones that take actions for you. Check Budgets pricing if you ever go past a couple.

  5. Clean-up step: Clean up

    Nothing to delete: you only looked around, and the budget is free.

    Keep the budget. It’s the one thing from this lab worth leaving in place for the whole course. If you do want to remove it later:

    In the AWS console: Billing and Cost ManagementBudgetsquickcart-monthlyActionsDelete

    You should see

    On the billing home page, this month’s costs are still $0.00, or a few cents at most.

Part 5: Check yourself

QuickCart needs 2 servers at night and 8 during the dinner rush. If it buys its own servers, how many does it pay for at 3am?

In the shared responsibility model, whose job is it to allow only the right traffic into QuickCart's database?

You create a server, then can't find it the next day. The Instances page says you have none. What's most likely?

What does an AWS budget do when your spending crosses its limit?

Which of these are global, the same whichever region the console shows?

Part 6: Cheat sheet

On one card
TermIn one line
The cloudRenting computers by the second instead of buying them
Pay for what existsA forgotten resource keeps costing money until you delete it
RegionA separate group of data centres, like us-east-1. Most things live in one
Global serviceNot tied to a region. IAM is the main one
Region selectorTop right of the console. Empty list? Check it first
Account ID12 digits, in the account menu. Shown in this course as 111122223333
Shared responsibilityAWS secures the cloud; you secure what you put in it
BudgetEmails you when spending crosses a limit. Never stops anything
Every labEnds with a clean-up step. Always do it

Finished the build and the quiz? Mark it done to fill in its stop on the route map.