Outcome
By the end of this lesson, you will be able to explain what compute is, describe a virtual machine by its size, and work out what one costs for a month.
| Prerequisites | I.1 |
| Time | 8 minutes |
1. Concept
Compute is thinking power: a computer doing work for you. It is the part that runs your website, crunches your numbers or answers your customers’ clicks.
In the cloud, compute usually comes as a virtual machine, often shortened to VM. A virtual machine is a slice of a big physical computer that behaves like a complete computer of its own. It has its own operating system (the base software, such as Linux or Windows), its own memory and its own share of the processor. You cannot see or touch it, but to your software it looks exactly like a real machine.
Each provider has its own name for the same thing:
- AWS calls them EC2 instances. “Instance” is cloud language for one running copy of a machine.
- Google Cloud calls them Compute Engine VMs.
- Azure calls them Virtual Machines.
Sizes, like T-shirts
You do not build a VM part by part. You pick a size from a menu, a bit like choosing a T-shirt in small, medium or large. Each size is a fixed mix of two main things:
- vCPUs. A vCPU (virtual CPU) is a unit of processor power. More vCPUs means the machine can do more work at once.
- Memory, also called RAM. This is the machine’s short-term working space, measured in gigabytes (GB) or gibibytes (GiB, almost the same thing).
A small VM might have 2 vCPUs and 4 GB of memory. A large one might have 64 vCPUs and 256 GB. Providers also offer families tuned for different jobs: some with extra memory, some with extra processor power, some with special chips for graphics or AI work.
What the meter counts
Compute is charged for the time the machine is switched on. The price is quoted per hour, though many providers count in seconds or minutes. Roughly:
- A bigger size costs more per hour. Doubling the vCPUs and memory roughly doubles the rate.
- The same size costs different amounts in different regions and on different operating systems. Some operating systems, such as Windows, carry a licence fee on top.
- The meter does not care how busy the machine is. A VM doing nothing costs the same per hour as one working flat out.
That last point is the one that matters most for cost. You pay for the size you chose, for every hour it is on, whether you use it or not.
When you stop a VM, the compute meter stops. You will learn in L2 that its disk keeps charging, and in I.3 why that catches people out.
2. Worked example
A team runs three VMs. All prices are illustrative, and the month is counted as 730 hours.
| VM | Size | Illustrative rate | Hours on | Monthly cost |
|---|---|---|---|---|
| Website | 2 vCPU, 8 GB | $0.10 per hour | 730 | $73 |
| Reporting | 8 vCPU, 32 GB | $0.40 per hour | 730 | $292 |
| Test machine | 8 vCPU, 32 GB | $0.40 per hour | 730 | $292 |
The reporting machine runs a report once a night, which takes about an hour. The test machine is used by one engineer on weekdays. Both are charged for all 730 hours.
Two cheaper options sit in plain sight:
- If the reporting machine only needs 2 vCPUs, the smaller size would cost $73 instead of $292. Picking a smaller size is called right-sizing.
- If the test machine were switched off outside working hours (on for about 220 hours a month), it would cost $88 instead of $292.
Nothing about the work changes. Only the size and the hours change, and those are the two numbers compute is priced on.
3. Hands-on (5 min: no account needed)
1. Open the AWS Pricing Calculator: calculator.aws2. Choose "Create estimate", then search for and add "Amazon EC2".3. Pick any region. Choose an instance with 2 vCPUs and 8 GiB of memory.4. Note the monthly estimate it shows for a machine on all month.5. Change the instance to one with 8 vCPUs and 32 GiB. Note the new estimate.6. Change usage to about 220 hours a month. Note the estimate again.You should see the price grow roughly in step with the size, and shrink in step with the hours. If you prefer, do the same in the Google Cloud Pricing Calculator (cloud.google.com/products/calculator) or the Azure Pricing Calculator (azure.microsoft.com/pricing/calculator). The menus differ; the arithmetic is the same.
4. Knowledge check
Q1
What is a virtual machine?
A. A physical server that one customer buys and keeps in the provider’s building
B. A program that pretends to be a person using a computer
C. A backup copy of a computer kept in case the original breaks
D. A slice of a big physical computer that behaves like a complete computer
Show answer
Correct: D. A VM shares a physical machine with others but has its own operating system, memory and processor share. A describes owning hardware, not renting a VM. B and C describe other things entirely: automation and backups.
Q2
A VM is switched on all month but does almost no work. How is it charged?
A. At the full hourly rate for every hour it was on
B. Only for the minutes when it was busy
C. At a reduced idle rate set by the provider
D. Nothing, as long as nobody logged in to it
Show answer
Correct: A. Compute is charged for time switched on, at the rate for the size you chose. There is no idle rate, and the provider does not check whether anyone used it.
Q3
Which two things mainly decide a VM’s size?
A. Its disk space and the number of users
B. The number of vCPUs and the amount of memory
C. Its region and the time of day it runs
D. Its operating system and its web address
Show answer
Correct: B. A size is a fixed mix of processor power (vCPUs) and memory. Region and operating system change the price of a size but are not the size itself. Disk space is rented separately, as storage.
5. Apply
When you see a compute line on a bill, ask two questions. How big is it? And how many hours was it on? If the answer to the second is “all month” and the machine only works some of the time, you have found the most common way money leaks out of a cloud account.
Related lessons
- L2, Storage: space you rent by the gigabyte (next)
- I.1 L1, Renting someone else’s computers by the hour