Getting started with AWS Local Zones - AWS Local Zones

Getting started with AWS Local Zones

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.

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

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. From the navigation bar, choose the Regions selector and then choose the parent Region.

  3. On the navigation pane, choose EC2 Dashboard.

  4. In the upper-right corner of the page, choose Account attributes, Zones.

  5. For the Local Zone to enable, choose Manage.

  6. For Zone group, choose Enabled.

  7. Choose Update 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-name us-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 from the VPC IPv4 CIDR block. If the VPC has an IPv6 CIDR block, you can specify an IPv6 CIDR block from the VPC IPv6 CIDR block. 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

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

  2. From the navigation bar, choose the Regions selector and then choose the parent Region.

  3. In the navigation pane, choose Subnets.

  4. Choose Create subnet.

  5. For VPC, select the VPC.

  6. 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.

  7. For Availability Zone, choose the Local Zone that you enabled.

  8. Specify an IPv4 CIDR block for the subnet.

  9. (Optional) To add a tag, choose Add new tag and enter the tag key and tag value.

  10. 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-zone us-west-2-lax-1a \ --vpc-id vpc-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 EC2 instance in a Local Zone.

To launch an EC2 instance in a Local Zone subnet using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Choose Launch instance.

  3. For Name and tags, enter a 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.

  4. For Application and OS Images (Amazon Machine Image), choose an operating system for your instance.

  5. For Instance type, select an instance type that's supported in a Local Zone, such as t3.micro.

  6. For Key pair (login), choose an existing key pair or create a new one.

  7. For Network settings, choose Edit, and then select your VPC, Local Zone subnet, and security group.

  8. When you are finished configuring your instance, choose Launch instance.

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-id subnet-08fc749671b2d077c \ --instance-type t3.micro \ --image-id ami-0abcdef1234567890 \ --security-group-ids sg-0b0384b66d7d692f9 \ --key-name my-key-pair

Step 4: Clean up

When you are finished with a Local Zone, you can disable it. Before you can disable a Local Zone, you must delete the resources in the Local Zone.

To disable a Local Zone using the console

  1. On the navigation pane, choose EC2 Dashboard.

  2. In the upper-right corner of the page, choose Account attributes, Zones.

  3. For the Local Zone to enable, choose Manage.

  4. For Zone group, choose Disabled.

  5. Choose Update zone group.

To disable a Local Zone using the AWS CLI

Use the modify-availability-zone-group command as follows to disable a specific Local Zone.

aws ec2 modify-availability-zone-group \ --region us-west-2 \ --group-name us-west-2-lax-1 \ --opt-in-status not-opted-in