Tools such as the AWS latency tester [https://aws-latency-test.com] help predict the latency benefits that a given device will experience when connecting through an AWS Local Zone vs a region:
Figure 6.6 – AWS Local Zone latency test output
This figure shows a small snippet of the output of this tool. It will geolocate the client’s IP and use a series of JavaScript functions to sample the latency to every AWS region and AWS Local Zone. Of course, the best test would be to spin up an EC2 instance or container running your application in the target zone. To do that, you will first need to opt in.
Opting into AWS Local Zones
AWS Local Zones are not enabled by default in your AWS account. You must opt into each one explicitly. This can be done in the AWS Management Console by navigating to VPC > Dashboard and clicking on the Zones link, as shown in the following figure:
Figure 6.7 – The VPC dashboard in the AWS Management Console
This must be done on a per-region basis and can become quite tedious, especially once you have multiple AWS accounts involved in an organization. It is best to automate this process, and there are multiple ways to go about this. With the AWS CLI, execute the following command to see which AWS Local Zones are children of a given region in an easy-to-read, tabular format:
aws ec2 describe-availability-zones \
–region us-west-2 \
–filters Name=zone-type,Values=local-zone \
–all-availability-zones \
–query AvailabilityZones[*].[*] \
–output text | sort
The next figure shows part of the output from the preceding command. The columns shown here are, in order, Group Name, Zone Type, Parent ZoneName, and Parent ZoneId:
Figure 6.8 – Child AWS Local Zones of us-west-2 (Oregon)
Availability zone identifiers: ZoneId vs ZoneName
All availability zones, including Local Zones, have two identifiers—a ZoneId and a ZoneName. The ZoneId is unique and consistent at all times. However, the ZoneName is a dynamic alias pointing to the static ZoneId. These aliases are randomly generated for an account whenever it is created.
Therefore, what you call us-west-2a could be what another customer calls us-west-2b. This is done to balance the utilization of the zones. Without this, the a zone in each region would be heavily overutilized compared to the others.
Each AWS Local Zone is tied to not only a parent region but also to a specific availability zone. It is, therefore, important to keep track of the physical ZoneId as we proceed.
The following command will opt into a given AWS Local Zone for the account in question. We need to do this using the Group Name, which is an identifier for all AWS Local Zones in a given metro area. Some, such as the one in Los Angeles, have multiple zones, similar to a region:
aws ec2 modify-availability-zone-group \
–region us-west-2 \
–group-name us-west-2-lax-1 \
–opt-in-status opted-in
Note that once you opt into an AWS Local Zone, you must contact AWS support to opt out.