ENع
←Regions and zones
Lesson 03 · The cloud

Regions and availability zones

10 min10 steps5 questionsBeginner
About this lesson

Cloud computers live in real buildings called data centres. Providers group them into regions, separate geographic areas such as eu-west-1 in Ireland, and inside each region into availability zones: buildings with their own power, cooling and network. Follow one app as it runs a copy in every zone behind a load balancer, survives a zone losing power, and keeps a backup in a second region.

You'll learn to

Tick what you feel confident about. These self-checks do not affect your lesson score.

Fig 3 · Interactive
01 / 10

The cloud is real buildings

The cloud is not in the sky. A cloud provider rents you computers that sit in data centres: big buildings full of servers, with their own power, cooling and network links. Where those buildings are matters.

cloud server = a real computer
  in a data centre (a building)
  with power, cooling, network

you rent it; the provider runs the building
so: where is the building?
Loading figure…
or ← →
Read the lesson step by step
  1. The cloud is real buildings

    The cloud is not in the sky. A cloud provider rents you computers that sit in data centres: big buildings full of servers, with their own power, cooling and network links. Where those buildings are matters.

    cloud server = a real computer
      in a data centre (a building)
      with power, cooling, network
    
    you rent it; the provider runs the building
    so: where is the building?
  2. A region is an area

    A region is a separate geographic area where the provider has data centres. AWS gives each one a code: eu-west-1 is Ireland, us-east-1 is Northern Virginia. You choose the region when you create a server.

    region = a geographic area
      eu-west-1  Europe (Ireland)
      us-east-1  US East (N. Virginia)
    
    Google Cloud and Azure use the same idea
      (e.g. us-central1, westeurope)
  3. Zones inside a region

    A region holds availability zones (AZs). Each zone is one or more data centres with its own power, cooling and network. AWS puts zones many kilometres apart, all within 100 km, joined by fast private links. Every AWS region has at least three.

    eu-west-1 → three zones
      eu-west-1a  own power, cooling, network
      eu-west-1b  own power, cooling, network
      eu-west-1c  own power, cooling, network
    
    many km apart, all within 100 km
    fast links between them
  4. Pick a region

    Choose the region near your users: data takes time to travel, so near means faster replies. Also check the law (some data must stay in one country), the price and the services offered. Our users are in Europe, so eu-west-1.

    choosing a region (AWS guidance)
      latency     near your users = faster
      compliance  where data may be stored
      cost        prices differ by region
      services    not every service is everywhere
    
    users in Europe → eu-west-1
  5. A copy in every zone

    Now deploy the app. Instead of one server, run an identical copy in each zone: eu-west-1a, eu-west-1b, eu-west-1c. If one building has a problem, the other copies keep working. This is a multi-AZ deployment.

    one copy of the app per zone
      eu-west-1a  app copy a
      eu-west-1b  app copy b
      eu-west-1c  app copy c
    
    no single building can stop the service
      = multi-AZ deployment
  6. A load balancer shares work

    A load balancer sits in front. Every request from a user reaches it first, and it passes each one to a copy of the app, spreading the work. Users see one address. They never choose a zone.

    user → load balancer → a copy
      request 1 → app copy a
      request 2 → app copy b
      request 3 → app copy c
    
    one address for users, three copies behind it
  7. Health checks

    The load balancer also runs health checks: on a timer it asks each copy a simple question, such as fetching a test page. A copy that answers is marked healthy. Line 1 of the card keeps the same record.

    health check: "are you there?"
      every copy answers → all up
    
    up = {"a": True, "b": True, "c": True}
    
    AWS ALB default: every 30 s,
      2 failed checks → unhealthy
  8. A zone goes dark

    Zone eu-west-1b loses power. Its copy stops answering, its health checks fail, and it is marked down. Line 2 records it: up["b"] = False. The other zones are separate buildings, so they keep running.

    eu-west-1b: power cut
      ping → copy b … no answer
      marked unhealthy
    
    up["b"] = False
    
    zones a and c: unaffected
  9. Traffic flows around it

    Now requests go only to the healthy copies, in zones a and c. Line 3 lists them and prints ['a', 'c']. Users notice nothing. But each remaining copy now carries more of the load, so plan spare room.

    print([z for z in up if up[z]])
    ['a', 'c']
    
    requests → copy a, copy c only
    users notice nothing
    each copy takes 1/2 of the load, not 1/3
  10. A second region

    Rarely, a problem hits a whole region. So keep a backup copy of your data in a second region far away, such as us-east-1. Being ready to recover there is called disaster recovery. Zones guard against a building failing; regions guard against an area failing.

    backup: eu-west-1 → us-east-1
    
    zone fails    → other zones serve
    region fails  → recover in another region
      = disaster recovery

Quiz Unlocks after the last step.