Lesson 1 of 8 in Cloud fundamentals with AWS
What the cloud is: regions, zones and who secures what
The cloud is a set of computing services you rent over the internet and pay for by usage, instead of buying and running your own hardware. A provider such as AWS runs the data centres and you create what you need through a web console, a command line or an API.
Draft. This lesson is written and waiting for a person to run every command and review it. It is safe to learn from, but check the official documentation for anything you depend on.
Read these first: Networking for DevOps
The problem this solves
Before cloud providers, starting a project meant buying servers, finding a room for them, wiring them up and waiting weeks. If the project failed, you still owned the hardware. If it succeeded quickly, you could not add capacity fast enough.
A cloud provider has already built the buildings, power, cooling and network. You ask for a server, a disk or a database, use it for as long as you need it, and stop paying when you delete it. That last part is also the danger: anything you forget to delete keeps billing.
Two questions come up immediately. Where physically does your server live, and who is responsible when something goes wrong? Regions, availability zones and the shared responsibility model answer those.
How it works
- People and clients
- Other
- Runs code
You pick one Region, and that Region contains several availability zones, each a separate group of data centres joined by fast private links.
- You to Region: 1 pick a Region
- Region to Zone A: 2 contains
- Region to Zone B: 2 contains
- Region to Zone C: 2 contains
- Runs code
- Control
- People and clients
Moving from virtual machines to a managed platform to finished software, the provider takes over more of the work and you control less.
- IaaS to PaaS: provider takes over more
- PaaS to SaaS: provider takes over more
A Region is a geographic area with a name, for example eu-west-1. Each Region is independent: resources you create in one Region are invisible in another, and each has its own service endpoint. An availability zone (AZ) is one or more data centres inside a Region with its own power and network. AZs in a Region are close enough to talk quickly and far enough apart that one fire or power failure should not take down all of them.
Service models describe how much you manage. With infrastructure as a service (IaaS), such as an EC2 virtual machine, you get the machine and you patch the operating system and run the app. With platform as a service (PaaS), you hand over code and the provider runs the machines beneath it. With software as a service (SaaS), such as web email, you only use the finished product.
The shared responsibility model splits the work. The provider secures the cloud itself: buildings, hardware and the virtualisation layer. You secure what you put in it: who has access, how things are configured, and your data. A storage bucket left open to the world is your mistake, not the provider's.
Azure and Google Cloud use the same ideas with different names. Azure has regions and availability zones. Google Cloud has regions and zones. This topic teaches AWS names first and notes the equivalents as they come up.
Try it yourself
This concept needs no cloud account and creates nothing. Use Linux, macOS or WSL for the first step.
- 1See that every Region has its own address
dig +short ec2.us-east-1.amazonaws.com dig +short ec2.eu-west-1.amazonaws.com
Each Region has its own service endpoint, so the two names resolve to different addresses. The exact addresses change over time, so do not expect to match anyone else's output. If
digis missing, usenslookupwith the same names. - 2Count the zones in a Region
In a browser, open the AWS Global Infrastructure page (search for 'AWS Regions and Availability Zones'). Find the Region closest to you and read how many availability zones it lists. Most Regions list at least three.
- 3Learn the same ideas under other names
Closest equivalents, AWS then Azure then Google Cloud. Region: Region, region, region. Zone: Availability Zone, Availability Zone, zone. Virtual machine: EC2, Virtual Machines, Compute Engine. Object storage: S3, Blob Storage, Cloud Storage. Private network: VPC, Virtual Network, VPC network. Keep this list nearby. Later concepts add to it.
What breaks, and where to look
You created something a minute ago, but the console shows an empty list.
- WHY IT HAPPENS
- The console and the CLI each work in one Region at a time. You are looking at a different Region from the one you created the resource in.
- CHECK FIRST
- Read the Region name in the top bar of the console. In a terminal run
aws configure listand look at the region row, then add--region <name>to a command to look elsewhere.
Your app went offline during a zone problem even though it runs 'in the cloud'.
- WHY IT HAPPENS
- Running in the cloud does not mean running in more than one place. One virtual machine in one availability zone has the same single point of failure as one server in one room.
- CHECK FIRST
- List where your instances live with
aws ec2 describe-instances --query "Reservations[].Instances[].[InstanceId,Placement.AvailabilityZone]" --output table. If every row shows the same zone, there is no spare.
When not to use this
- The cloud is not automatically cheaper. A steady, predictable workload can cost less on hardware you own or on a small rented server.
- Some data must stay in a specific country or on specific hardware for legal reasons. Check the rules for your data before you pick a Region.
Check yourself
What is the difference between a Region and an availability zone?
A Region is a named geographic area. An availability zone is one or more separate data centres inside that Region, with its own power and network.
Who is responsible for a storage bucket that is left open to the public?
You are. The provider secures the underlying infrastructure, and you secure your configuration, access and data.
Why can a resource you just created be missing from the console?
Resources belong to one Region, and you are probably viewing a different Region.
Lesson 55 of 92 in the DevOps path