What the cloud is
Renting computers by the second, and what that changes.
Part 1: The problem
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 servers | Renting from the cloud | |
|---|---|---|
| Getting a new server | Order it, wait days or weeks, install it | A minute or two |
| Paying | Up front, for the most you’ll ever need | Per second or per hour, for what exists right now |
| A quiet night | You still pay for every server | You can run fewer and pay less |
| A sudden rush | You’re stuck with what you bought | Start more, then remove them afterwards |
| A broken disk | Your problem, at 3am | The provider replaces the hardware |
| Forgetting something | It’s already paid for | It 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.
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:
| Service | What it is | QuickCart uses it for |
|---|---|---|
| IAM | Users, roles and permissions | Deciding who and what can change anything |
| VPC | Your own private network | Keeping the database off the internet |
| EC2 | Virtual servers | Running the API |
| Elastic Load Balancing | One address in front of many servers | Sharing orders across servers |
| RDS | Managed databases | Storing every order |
| S3 | Storage for files | Menu photos and receipts |
| CloudWatch | Logs, metrics and alarms | Knowing when something breaks |
| Route 53 | DNS, for domain names | Pointing 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 after | You look after |
|---|---|
| The buildings, guards and power | Who can log in to your account, and with what permissions |
| The physical servers, disks and network cables | Which traffic your network rules let in |
| The software that splits one physical machine into many virtual ones | Updating the operating system on your servers |
| Keeping managed services such as RDS running | Your app’s code and its secrets |
| Replacing broken hardware | Encrypting 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:
| Habit | What it means |
|---|---|
| A budget from day one | AWS Budgets emails you when spending crosses a limit you set, or is forecast to |
| Tags on everything | A label like Project = quickcart on each resource, so you can see what costs what |
| Clean up after every lab | Every 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.
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.
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.
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 seeA 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
IAMin the search bar at the top and open it.You should seeThe region selector now says Global and can’t be changed. IAM is one of the few services that isn’t tied to a region.
Find your account ID
Choose your account name at the top right of the console.
You should seeA 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.
Open the billing home page
In the AWS console: Billing and Cost ManagementHome
You should seeA 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 seeWhat 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.
Create a budget that emails you
In the AWS console: Billing and Cost ManagementBudgetsCreate budget
Field Enter Budget setup Use a template (simplified) Templates Monthly cost budget Budget name quickcart-monthlyEnter your budgeted amount ($) 10.00, or whatever you’re comfortable spending on this course each monthEmail recipients your own email address Choose Create budget.
You should seequickcart-monthlyin 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.
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 seeOn 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
| Term | In one line |
|---|---|
| The cloud | Renting computers by the second instead of buying them |
| Pay for what exists | A forgotten resource keeps costing money until you delete it |
| Region | A separate group of data centres, like us-east-1. Most things live in one |
| Global service | Not tied to a region. IAM is the main one |
| Region selector | Top right of the console. Empty list? Check it first |
| Account ID | 12 digits, in the account menu. Shown in this course as 111122223333 |
| Shared responsibility | AWS secures the cloud; you secure what you put in it |
| Budget | Emails you when spending crosses a limit. Never stops anything |
| Every lab | Ends with a clean-up step. Always do it |