Sub topic 2
Choosing an AWS Region
Assume you know basic cloud, networking, and terminal commands. A Region is a separate geographic area. Choose it before creating resources because many services and resources stay inside that Region.
Compare the main factors
- Latency: Choose a nearby Region to reduce network delay for users and applications.
- Compliance: Data residency rules may require data to remain in a particular country or legal area.
- Services: Check that the AWS services and features you need are available there.
- Price: Prices, taxes, and data-transfer charges differ between Regions. Compare the total design cost, including every Availability Zone and transfer path.
Inspect and select a Region
The AWS CLI uses a configured default Region unless a command supplies --region. This command lists Regions currently enabled for your account:
aws ec2 describe-regions \
--query "Regions[].RegionName" \
--output textSet a shell-wide default:
export AWS_DEFAULT_REGION=eu-west-1
aws configure get region
aws ec2 describe-availability-zones \
--query "AvailabilityZones[].ZoneName" \
--output textIn an SDK, set the Region when creating a client:
import boto3
ec2 = boto3.client("ec2", region_name="us-east-1")
print([az["ZoneName"] for az in ec2.describe_availability_zones()["AvailabilityZones"]])Enable an opt-in Region
Some Regions are disabled until you enable them. View all Regions and their status:
aws ec2 describe-regions --all-regions \
--query "Regions[?OptInStatus=='not-opted-in'].RegionName" \
--output textWith suitable permissions, enable one through the AWS account API:
aws account enable-region --region-name ap-east-1Enabling a Region does not create resources or remove the need to configure that Region explicitly.
Use AZ IDs for cross-account placement
An Availability Zone (AZ) is an isolated location inside a Region. AZ names such as us-east-1a can map to different physical zones in different AWS accounts. AZ IDs, such as use1-az1, provide a stable reference across accounts.
| Identifier | Use |
|---|---|
| AZ name, `us-east-1a` | Account-specific console and CLI placement |
| AZ ID, `use1-az1` | Coordinating placement across accounts |
Design across AZs
Place application instances in at least two AZs, then use a load balancer to distribute traffic. Put redundant data or database components in separate AZs when the service supports it. This layout can continue operating when one AZ fails, although capacity and service-specific behavior still matter.
Exercise
Why should two accounts use AZ IDs rather than matching AZ names?
Show answer
AZ names are assigned per account, while AZ IDs identify the same physical Availability Zone across accounts.