See which resources belong to a Region and which are global

short · 25 min · Task statement 3.2

Task

Map the three layers of AWS global infrastructure onto a real account. You will list the Regions open to you and the Availability Zones inside two of them, put an S3 bucket in a Region of your choosing and show that it stays there however you ask about it, make an IAM group and show that it is the same from every Region, and see in the console which services the edge network serves. At the end you can say whether a given failure, latency or data residency problem is solved by more Availability Zones, a second Region or edge locations.

Steps

  1. List the Regions this account can use, and read one Region's opt-in status:
aws ec2 describe-regions --query 'Regions[].RegionName' --output text
aws ec2 describe-regions --region-names eu-west-2 --query 'Regions[0].OptInStatus' --output text
aws ec2 describe-regions --all-regions --query "Regions[?OptInStatus=='not-opted-in'].RegionName" --output text

The second command prints opt-in-not-required. The third lists Regions that are turned off until someone opts in to them; leave them as they are. Do not count the Regions to memorise them: AWS adds more. 2. List the Availability Zones inside two Regions:

aws ec2 describe-availability-zones --region eu-west-2 --query 'AvailabilityZones[].[ZoneName,ZoneId,State]' --output table
aws ec2 describe-availability-zones --region ap-southeast-2 --query 'AvailabilityZones[].[ZoneName,ZoneId,State]' --output table

Each Region contains several AZs, and every zone name starts with its Region's code: a Region contains AZs, never the reverse. The zone name, such as eu-west-2a, can point to a different physical AZ in another account; the zone ID, such as euw2-az1, is the same for everyone. 3. Put a bucket in eu-west-2. Use your own account ID in the name:

aws s3api create-bucket --bucket clf-lab13-111122223333 --region eu-west-2 --create-bucket-configuration LocationConstraint=eu-west-2

New buckets keep S3 Block Public Access on, and this one holds nothing. 4. Ask where the bucket lives, first from its own Region and then from a different one:

aws s3api get-bucket-location --bucket clf-lab13-111122223333 --region eu-west-2 --query LocationConstraint --output text
aws s3api get-bucket-location --bucket clf-lab13-111122223333 --region us-east-1 --query LocationConstraint --output text

Both print eu-west-2. The bucket and anything put in it stay in London unless you copy them elsewhere: AWS does not move it. In the S3 console's bucket list, its AWS Region column reads Europe (London) eu-west-2. That is why choosing the Region is how you meet a data residency rule. 5. Now a global service. Make an IAM group and read it back through two distant Regions:

aws iam create-group --group-name clf-lab13-group
aws iam get-group --group-name clf-lab13-group --region ap-southeast-2 --query 'Group.GroupName' --output text
aws iam get-group --group-name clf-lab13-group --region us-west-2 --query 'Group.GroupName' --output text

Both print clf-lab13-group. IAM is global: the Region you name makes no difference, because the group belongs to the account, not to a Region. 6. Look at the edge network in the console. Open IAM, then Amazon CloudFront, then Route 53, and read the Region selector at the top right each time: for all three it reads Global. CloudFront caches content and Route 53 answers DNS queries from edge locations in many more cities than there are Regions. Do not create a CloudFront distribution; reading the page is enough. 7. In your own notes, match each problem to the layer that solves it: one data centre losing power (several AZs in one Region); a whole Region becoming unavailable (a second Region); users in Sydney waiting for images served from Europe (CloudFront at edge locations, or a Region nearer them); a law that customer records stay in the United Kingdom (choose a UK Region and keep the data there).

Verify

aws s3api get-bucket-location --bucket clf-lab13-111122223333 --region us-east-1 --query LocationConstraint --output text

Expected output: eu-west-2.

aws iam get-group --group-name clf-lab13-group --region ap-southeast-2 --query 'Group.GroupName' --output text

Expected output: clf-lab13-group.

aws ec2 describe-regions --region-names eu-west-2 --query 'Regions[0].OptInStatus' --output text

Expected output: opt-in-not-required.

Cost and clean-up

An empty S3 bucket and an IAM group are not charged for themselves, and the describe and get calls are free. Requests to S3 may be charged outside the Free Tier. Prices for the same service differ between Regions; compare them on each service's pricing page or in the AWS Pricing Calculator.

Created by this lab: the S3 bucket clf-lab13-111122223333 in eu-west-2; the IAM group clf-lab13-group.

  1. Delete the empty bucket clf-lab13-111122223333:
aws s3api delete-bucket --bucket clf-lab13-111122223333 --region eu-west-2
  1. Delete the IAM group clf-lab13-group, which has no members or policies:
aws iam delete-group --group-name clf-lab13-group

Check it is gone

aws s3api list-buckets --query "length(Buckets[?Name=='clf-lab13-111122223333'])"

Expected output: 0.

aws iam list-groups --query "length(Groups[?GroupName=='clf-lab13-group'])"

Expected output: 0.

Notes

The S3 console's own Region selector also reads Global, because its bucket list covers every Region; each bucket still has one home Region, shown in its AWS Region column. Edge locations cannot be listed with the CLI; AWS publishes them on its global infrastructure page.

This is an independent study companion for the AWS Certified Cloud Practitioner (CLF-C02) exam and is not produced by or endorsed by Amazon Web Services. AWS, Amazon Web Services and AWS Certified Cloud Practitioner are trademarks of Amazon.com, Inc. or its affiliates.

This is an independent study companion for AWS Certified Cloud Practitioner CLF-C02 and is not produced by or endorsed by CompTIA.