To get started with AWS Local Zones, you must first enable a Local Zone through the Amazon EC2 console or the AWS CLI. Next, create a subnet in a VPC in the parent Region, specifying the Local Zone when you create it. Finally, create AWS resources in the Local Zone subnet.
Tasks
Step 1: Enable a Local Zone
You can use the Amazon EC2 console or a command line interface to determine which Local Zones are available for your account, and then enable the Local Zone that you want to use.
To enable a Local Zone using the console
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
From the navigation bar, choose the Regions selector and then choose the parent Region.
-
From the Amazon EC2 console dashboard, in the Account attributes box, choose Zones.
-
(Optional) To filter the list of zones, choose the All Zones filter and then Local Zones.
-
Select the row of the Local Zone that you want to use.
-
Choose Actions, Manage Zone group.
-
On the Manage zone group pop-up, select Enable.
-
Choose Update.
-
To confirm that you want to enable the Local Zone, enter Enable.
-
Choose Enable zone group.
To enable a Local Zone using the AWS CLI
Use the describe-availability-zones command as follows to describe all Local Zones in the specified Region.
aws ec2 describe-availability-zones \ --region
us-west-2
\ --filters Name=zone-type,Values=local-zone \ --all-availability-zones
Use the modify-availability-zone-group command as follows to enable a specific Local Zone.
aws ec2 modify-availability-zone-group \ --region
us-west-2
\ --group-nameus-west-2-lax-1
\ --opt-in-status opted-in
Step 2: Create a Local Zone subnet
When you add a subnet, you must specify an IPv4 CIDR block for the subnet from the range of your VPC. You can optionally specify an IPv6 CIDR block for a subnet if there is an IPv6 CIDR block associated with the VPC. You can specify the Local Zone where the subnet resides. You can have multiple subnets in the same Local Zone.
To add a Local Zone subnet to a VPC using the console
-
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
From the navigation bar, choose the Regions selector and then choose the parent Region.
-
In the navigation pane, choose Subnets.
-
Choose Create subnet.
-
For VPC ID, select the VPC.
-
For Subnet name, enter a name for your subnet. Doing so creates a tag with a key of
Name
and the value that you specify. -
For Availability Zone, choose the Local Zone that you enabled.
-
Specify the IPv4 CIDR block for the subnet.
-
(Optional) Specify an IPv6 CIDR block for the subnet. This option is available only if an IPv6 CIDR block is associated with the VPC.
-
(Optional) To add a tag, enter the tag key and tag value. Choose Add new tag to add another tag.
-
Choose Create subnet.
To add a Local Zone subnet to a VPC using the AWS CLI
Use the create-subnet command as follows to create a subnet for the specified VPC in the specified Local Zone.
aws ec2 create-subnet \ --region
us-west-2
\ --availability-zoneus-west-2-lax-1a
\ --vpc-idvpc-081ec835f303f720e
Step 3: Create a resource in your Local Zone
subnet
After you create a subnet in a Local Zone, you can deploy AWS resources in the Local Zone. For example, the following procedure shows how to launch an Amazon EC2 instance in a Local Zone.
To launch an Amazon EC2 instance in a Local Zone subnet using the console
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
From the Amazon EC2 console dashboard, in the Launch instance box, choose Launch instance.
-
Under Name and tags, enter a descriptive name for the instance (for example, my-lz-instance). Doing so creates a tag with a key of
Name
and the value that you specify. -
Under Application and OS Images (Amazon Machine Image), do the following:
-
Select an operating system for your instance.
-
Select the Amazon Machine Image (AMI). An Amazon Machine Image (AMI) is a basic configuration that serves as a template for your instance.
-
Select the Architecture.
-
-
Under Instance type, from the Instance type list, select the hardware configuration for your instance that's supported in a Local Zone. For example, the
t3.micro
instance type. -
Under Key pair (login), choose an existing key pair or create a new one.
Warning
Do not choose Proceed without a key pair (Not recommended). If you launch your instance without a key pair, then you can't connect to it.
-
Next to Network settings, choose Edit, and then:
-
Select your VPC.
-
Select your Local Zone subnet.
-
Enable or disable Auto-assign public IP.
-
Create a security group or select an existing one.
-
-
You can keep the default selections for the other configuration settings for your instance. To determine the storage types that are supported, see the Compute and storage section in AWS Local Zones features
. -
Review a summary of your instance configuration in the Summary panel, and when you're ready, choose Launch instance.
-
A confirmation page lets you know that your instance is launching. Choose View all instances to close the confirmation page and return to the console.
-
On the Instances screen, you can view the status of the launch. It takes a short time for an instance to launch. When you launch an instance, its initial state is
pending
. After the instance starts, its state changes torunning
and it receives a public DNS name. If the Public IPv4 DNS column is hidden, choose the settings icon ( ) in the top-right corner, turn on Public IPv4 DNS, and choose Confirm. -
It can take a few minutes for the instance to be ready for you to connect to it. Check that your instance has passed its status checks; you can view this information in the Status check column.
To launch an EC2 instance in a Local Zone subnet using the AWS CLI
Use the run-instances command as follows to launch an instance in the specified Local Zone subnet.
aws ec2 run-instances \ --region
us-west-2
\ --subnet-idsubnet-08fc749671b2d077c
\ --instance-typet3.micro
\ --image-idami-0abcdef1234567890
\ --security-group-idssg-0b0384b66d7d692f9
\ --key-namemy-key-pair
Step 4: Clean up
When you are finished with a Local Zone, delete the resources in the Local Zone. Then contact AWS Support to disable it.