Sub topic 4
Global, regional, and zonal resources
This chapter assumes you know what a Region and an Availability Zone (AZ) are, and that you can run AWS CLI commands with credentials configured. It covers the three scopes a resource can have and how to predict where a resource will appear.
Three scopes
Every AWS resource has a scope. The scope decides where the resource exists, who can use it, and what happens when a Region or AZ fails.
| Scope | Lives in | Examples |
|---|---|---|
| Global | The account as a whole, not tied to one Region | IAM users, roles, and policies; Route 53 hosted zones; CloudFront distributions |
| Regional | One Region, spread across its AZs by AWS or by you | VPCs, security groups, AMIs, Lambda functions, S3 buckets, RDS instances |
| Zonal | One AZ | EC2 instances, EBS volumes, subnets |
Regional resources
A regional resource exists in exactly one Region. A security group created in eu-west-1 is invisible in us-east-1, even with the same account and credentials. The same applies to AMIs, key pairs, and Lambda functions. To use an AMI in another Region, you must copy it.
S3 is a common source of confusion. Bucket names are unique across all AWS accounts, but each bucket lives in one Region. The data stays in that Region unless you set up replication.
Zonal resources
A zonal resource is tied to one AZ. You pick the AZ indirectly, usually by choosing a subnet. A subnet belongs to one AZ, so an EC2 instance launched into it runs in that AZ. An EBS volume can attach only to an instance in the same AZ. If that AZ fails, the instance and volume are both affected.
Some regional services hide zones from you. RDS is a regional resource, and with Multi-AZ enabled it keeps a standby copy in a second AZ.
Global resources
Global resources are not selected by Region. IAM is the main example. A role you create works in every Region of the same partition.
Global does not mean "no Region involved". The IAM control plane runs in us-east-1 for the standard partition, and Route 53 and CloudFront are managed from there too. In the console, the Region selector shows "Global" for these services.
Seeing scope from the CLI
The commands below show the difference. The IAM call returns the same roles whichever Region you name. The EC2 call returns only the volumes in the Region you name.
aws iam list-roles --query "Roles[].RoleName" --output text --region us-east-1
aws iam list-roles --query "Roles[].RoleName" --output text --region eu-west-1
aws ec2 describe-volumes --region us-east-1 \
--query "Volumes[].[VolumeId,AvailabilityZone]" --output table
aws ec2 describe-volumes --region eu-west-1 \
--query "Volumes[].[VolumeId,AvailabilityZone]" --output tableThe AvailabilityZone column in the volume output is the zonal scope. The Region you passed is the regional scope.
Common errors
- Resource not found. You created it in one Region and queried another. Add
--regionor checkaws configure get region. - Cannot attach volume. The volume and the instance are in different AZs. Create a snapshot and restore it in the instance's AZ.
- Cross-Region reference fails. Many resources can reference only same-Region resources. For example, you cannot launch an instance with a security group from another Region.
- Unexpected charges. Forgotten resources in a Region you rarely use keep billing. Check the Regions you have used.
Summary
Check the scope of a resource before you design around it. Global resources need no placement choice. Regional resources need a Region. Zonal resources need an AZ, and a single zonal resource is a single point of failure.
Exercise
You launch an EC2 instance in a subnet in us-east-1a and create an EBS volume in us-east-1b. Attaching the volume fails. Why, and what are two ways to fix it?
Show answer
EBS volumes are zonal and attach only to instances in the same AZ. Fix it by snapshotting the volume and restoring the snapshot in us-east-1a, or by launching a new instance in us-east-1b.