Cloud Computing Concepts
Cloud computing means getting IT resources (computing power, storage, databases, networking, software) on demand over the internet, with pay-as-you-go pricing. Someone else owns and operates the data centres; you rent slices of them through an API.
The five essential characteristics
The US standards body NIST gives a widely used definition. A service is "cloud" when it has all five of these:
| Characteristic | Meaning | AWS example |
|---|---|---|
| On-demand self-service | You provision resources yourself, without calling a salesperson | Launch an EC2 instance from the console |
| Broad network access | Available over the network from many kinds of devices | Console, CLI, SDKs, mobile app |
| Resource pooling | The provider's hardware is shared by many customers (multi-tenancy) | Many accounts' VMs on the same physical hosts |
| Rapid elasticity | Capacity grows and shrinks quickly, often automatically | Auto Scaling adds servers at peak time |
| Measured service | Usage is metered and billed | Per-second EC2 billing, per-GB S3 storage |
Six advantages AWS likes to list
- Trade fixed expense for variable expense: no big up-front hardware purchase.
- Benefit from massive economies of scale: the provider buys hardware in huge volumes.
- Stop guessing capacity: scale up and down with real demand.
- Increase speed and agility: new resources in minutes, not weeks.
- Stop spending money running and maintaining data centres: focus on your product.
- Go global in minutes: deploy in another continent with the same tools.
Model: stop guessing capacity
Without the cloud you must buy enough servers for your peak load, and they sit idle the rest of the time. If you buy too few, users get errors at peak. This model compares a fixed fleet with an elastic one over a day of traffic. Each server handles 100 requests per second.
import math
# Requests per second, one value per 3-hour block of a day
demand = [80, 60, 150, 420, 610, 540, 380, 200]
per_server = 100
def needed(rps):
return math.ceil(rps / per_server)
fixed_fleet = 4 # bought up front: a guess
fixed_hours = fixed_fleet * 3 * len(demand)
elastic_hours = sum(needed(d) * 3 for d in demand)
dropped = sum(max(0, d - fixed_fleet * per_server) for d in demand)
print("block demand elastic-servers")
for i, d in enumerate(demand):
print(f"{i * 3:02d}:00 {d:>6} {needed(d):>6}")
print(f"fixed fleet : {fixed_hours} server-hours, overload in {sum(d > fixed_fleet * per_server for d in demand)} blocks")
print(f"elastic fleet: {elastic_hours} server-hours, no overload")
print(f"requests/s over capacity with fixed fleet (summed): {dropped}")block demand elastic-servers
00:00 80 1
03:00 60 1
06:00 150 2
09:00 420 5
12:00 610 7
15:00 540 6
18:00 380 4
21:00 200 2
fixed fleet : 96 server-hours, overload in 3 blocks
elastic fleet: 84 server-hours, no overload
requests/s over capacity with fixed fleet (summed): 370
The fixed fleet is both too big at night and too small at the evening peak. The elastic fleet follows demand and uses fewer server-hours in total. That is "stop guessing capacity" in one picture.
Model: measured service
Cloud bills are just metered usage multiplied by unit prices. Here is a tiny bill calculator with example prices (check the AWS pricing pages for real ones):
example_prices = {
"vm_hours": 0.05, # $ per instance-hour
"storage_gb_month": 0.023, # $ per GB-month
"requests_million": 0.40, # $ per million API requests
"egress_gb": 0.09, # $ per GB sent to the internet
}
usage = {
"vm_hours": 2 * 730, # two VMs for a whole month
"storage_gb_month": 250,
"requests_million": 12,
"egress_gb": 40,
}
total = 0
for item, qty in usage.items():
cost = qty * example_prices[item]
total += cost
print(f"{item:<18} {qty:>8,} x ${example_prices[item]:<6} = ${cost:>8.2f}")
print(f"{'total':<18} {'':>8} {'':<7} = ${total:>8.2f}")vm_hours 1,460 x $0.05 = $ 73.00
storage_gb_month 250 x $0.023 = $ 5.75
requests_million 12 x $0.4 = $ 4.80
egress_gb 40 x $0.09 = $ 3.60
total = $ 87.15
Tip: 730 is the number of hours AWS uses for "one month" in many price calculations (8,760 hours in a year divided by 12).
Capital expense vs operating expense
CapEx (capital expenditure) is money spent up front on assets that you own, like servers and buildings. OpEx (operating expenditure) is the ongoing cost of running the business, like a monthly cloud bill. Moving to the cloud shifts IT spending from CapEx to OpEx, which helps start-ups (no big investment) and makes experiments cheap: a failed experiment just stops costing money when you delete it.
Common misconceptions
- "The cloud is always cheaper." Not automatically. A steady, always-on workload on a badly sized instance can cost more than owned hardware. Cost optimisation is a skill (see the pricing lesson).
- "The cloud is someone else's problem." The provider secures the infrastructure, but you still secure your data and configuration (see the shared responsibility lesson).
- "Elastic means infinite." Accounts have service quotas, and scaling takes minutes, not milliseconds.
Test yourself
Which characteristic describes capacity that grows and shrinks quickly with demand?
- Resource pooling
- Rapid elasticity
- Measured service
- Broad network access
In the capacity model, why does the fixed fleet do badly?
- It is too large at all times
- It is idle at night and overloaded at the peak
- It costs nothing
- It cannot run at night
Moving to the cloud mostly shifts spending from ...
- OpEx to CapEx
- CapEx to OpEx
- Salaries to hardware
- Software to hardware