AWS Local Zones enable organizations to deploy compute-driven applications into redundant data centers located near densely populated areas. This improves an application's response time through the reduction of network latency.
To deploy an application into an AWS Local Zone, do the following:
- Select your AWS Local Zone location and service.
- Enable the Local Zone in AWS Management Console.
- Extend a VPC into the enabled Local Zone.
- Deploy an AWS service, like EC2, into the Local Zone's subnet.
- Install, configure and run your app on the Local Zone hosted service.
1. Select your AWS Local Zone location and service
If your application can benefit from the use of an AWS Local Zone, find the Local Zone location that works best for your use case. Amazon has built over 30 Local Zones worldwide in cities such as Los Angeles; Taipei, Taiwan; Perth, Australia; Lagos, Nigeria; and Kolkata, India.
Local Zones are limited in the services they offer in comparison to Availability Zones (AZs). Typically, an AWS Local Zone is useful only if your application is hosted on an AWS compute platform, such as Amazon EC2, ECS and Elastic Kubernetes Service. Some Local Zones, such as the one in Los Angeles, offer supplemental services, such as ElastiCache and Relational Database Service, but such support is rare.
Once you have chosen your city and the service, install the application into the chosen Local Zone. In the following AWS Local Zone deployment example, we demonstrate how to deploy an Nginx server onto an EC2 instance hosted in the Denver Local Zone. The steps used to deploy to the Denver Local Zone are similar for any other Local Zone supported city.
2. Enable the Local Zone in AWS Management Console
Services hosted in AWS Local Zones cost marginally more than the equivalent service in an AWS Region. To avoid users accidentally paying extra for low-latency deployments they don't need, Amazon disables all Local Zones by default. As a result, the first step in the deployment of a low-latency app in AWS is to enable your Local Zone of choice.
Enable Local Zones
To enable an AWS Local Zone, follow these steps:
- Step 1. From the EC2 dashboard, click the Zones link.
- Step 2. Select Manage on the Local Zone of interest, and click Enable.
- Step 3. Finally, select Enable Zone Group, and confirm your decision.
When the listing of Local Zones reappears, the Local Zone is enabled.
3. Extend a VPC into the enabled Local Zone
After you enable a Local Zone, it must be added to a VPC in the region. This extends the VPC, which already includes the region's AZ, into the enabled Local Zone.
To do this, follow these steps:
- Step 1. Select Subnets from the EC2 dashboard, and click Create Subnet.
- Step 2. Choose the target VPC to extend into the Local Zone.
- Step 3. Provide a name for the subnet.
- Step 4. Select the recently enabled Local Zone as the AZ.
- Step 5. Specify a Classless Inter-Domain Routing (CIDR) block for the subnet to use.
In this example, the subnet is named denver-subnet. After you create the subnet, return to the VPC's details page. View its resource map to see the new denver-subnet added alongside the other AWS AZs.
4. Deploy an AWS service into the Local Zone's subnet
The steps to run an EC2 instance in a Local Zone mirror the steps to deploy into a regular AZ with two exceptions:
- In Network Settings, the Local Zone must be selected as the subnet.
- An instance type that a Local Zone supports must be selected.
Local Zones do not have the same expanse of hardware configurations that are available on AZs. For example, the Las Vegas and Denver Local Zones do not support t2.micro, t2.small or t3.medium deployments.
EC2 instance configuration
For this example, the following EC2 instance configuration is used:
- Name: Denver Fanclub.
- Amazon Machine Image: Amazon Linux 2.
- Type: t3.medium.
- Key pair: Previously created PuTTY Private Key or Privacy-Enhanced Mail.
- Allow HTTP traffic: Enabled.
- Subnet: denver-fanclub.
- Auto assign public IP: Enabled.
With this configuration in place, click the Launch Instance button, and deploy the EC2 instance.
5. Install, configure and run your app on the Local Zone hosted service
With the EC2 instance launched, the Local Zone hosting environment is invisible to the end user and to the administrator who manages the server.
To deploy an application like Nginx to the EC2 instance, connect Secure Shell (SSH) into the remote VM and run the requisite installation and configuration commands.
To deploy Nginx, the following commands can be issued through SSH:
[ec2-user]$ sudo amazon-linux-extras install nginx1
[ec2-user]$ sudo systemctl start nginx
With Nginx started, point a browser at the EC2 instance's public IP address. The Nginx landing page appears, offering proof that the deployment of your Nginx software into a low-latency AWS Local Zone succeeded.