Deploy resources in an AWS Wavelength Zone by using Terraform - AWS Prescriptive Guidance

Deploy resources in an AWS Wavelength Zone by using Terraform

Created by Zahoor Chaudhrey (AWS) and Luca Iannario (AWS)

Code repository: terraform-wavelength-infrastructure

Environment: PoC or pilot

Technologies: Networking; Infrastructure; Content delivery; Web & mobile apps

AWS services: Amazon EC2; Amazon VPC; AWS Wavelength

Summary

AWS Wavelength helps you build infrastructure that is optimized for Multi-Access Edge Computing (MEC) applications. Wavelength Zones are AWS infrastructure deployments that embed AWS compute and storage services within communications service providers’ (CSP) 5G networks. Application traffic from 5G devices reaches application servers running in Wavelength Zones without leaving the telecommunications network. The following facilitate network connectivity through Wavelength:

  • Virtual private clouds (VPCs) – VPCs in an AWS account can extend to span multiple Availability Zones, including Wavelength Zones. Amazon Elastic Compute Cloud (Amazon EC2) instances and related services appear as part of your Regional VPC. VPCs are created and managed in Amazon Virtual Private Cloud (Amazon VPC).

  • Carrier gateway – A carrier gateway enables connectivity from the subnet in the Wavelength Zone to the CSP network, the internet, or the AWS Region through the CSP’s network. The carrier gateway serves two purposes. It allows inbound traffic from a CSP network in a specific location, and it allows outbound traffic to the telecommunications network and the internet.

This pattern and its associated Terraform code help you launch resources, such as Amazon EC2 instances, Amazon Elastic Block Store (Amazon EBS) volumes, VPCs, subnets, and a carrier gateway, in a Wavelength Zone.

Prerequisites and limitations

Prerequisites

  • An active AWS account

  • An integrated development environment (IDE)

  • Opt in to the target Wavelength Zone

  • AWS Command Line Interface (AWS CLI), installed and configured

  • Terraform version 1.8.4 or later, installed (Terraform documentation)

  • Terraform AWS Provider version 5.32.1 or later, configured (Terraform documentation)

  • Git, installed (GitHub)

  • Permissions to create Amazon VPC, Wavelength, and Amazon EC2 resources

Limitations

Not all AWS Regions support Wavelength Zones. For more information, see Available Wavelength Zones in the Wavelength documentation.

Architecture

The following diagram shows how you can create a subnet and AWS resources in a Wavelength Zone. VPCs that contain a subnet in a Wavelength Zone can connect to a carrier gateway. A carrier gateway allows you to connect to the following resources:

  • 4G/LTE and 5G devices on the telecommunication carrier's network.

  • Fixed wireless access for select Wavelength Zone partners. For more information, see Multi-access AWS Wavelength.

  • Outbound traffic to public internet resources.

A carrier gateway connects AWS resources in the Wavelength Zone to the CSP network.

Tools

AWS services

  • Amazon Virtual Private Cloud (Amazon VPC) helps you launch AWS resources into a virtual network that you’ve defined. This virtual network resembles a traditional network that you’d operate in your own data center, with the benefits of using the scalable infrastructure of AWS.

  • AWS Wavelength extends AWS Cloud infrastructure to telecommunication providers’ 5G networks. This helps you build applications that deliver ultra-low latencies to mobile devices and end users.

Other tools

  • Terraform is an infrastructure as code (IaC) tool from HashiCorp that helps you create and manage cloud and on-premises resources.

Code repository

The code for this pattern is available in the GitHub Creating AWS Wavelength Infrastructure using Terraform repository. The Terraform code deploys the following infrastructure and resources:

  • A VPC

  • A Wavelength Zone

  • A pubic subnet in the Wavelength Zone

  • A carrier gateway in the Wavelength Zone

  • An Amazon EC2 instance in the Wavelength Zone

Best practices

Epics

TaskDescriptionSkills required

Clone the repository.

Enter the following command to clone the Creating AWS Wavelength Infrastructure using Terraform repository to your environment.

git clone git@github.com:aws-samples/terraform-wavelength-infrastructure.git

DevOps engineer

Update the variables.

  1. Navigate to the cloned repository.

    cd terraform-wavelength-infrastructure
  2. Using any text editor, create a file called terraform.tfvars in the root directory.

  3. Create the following variables and enter their values:

    • region = <enter Region name>

    • vpc_cidr = <enter CIDR block used by VPC>

    • wavelength_subnet_cidr = <enter CIDR block for the subnet in the Wavelength Zone>

    • availabilityzone_wavelength = <enter Wavelength Zone name>

  4. Save the terraform.tfvars file.

DevOps engineer, Terraform

Initialize the configuration.

Enter the following command to initialize the working directory.

terraform init
DevOps engineer, Terraform

Preview the Terraform plan.

Enter the following command to compare the target state against the current state of your AWS environment. This command generates a preview of the resources that will be configured.

terraform plan
DevOps engineer, Terraform

Verify and deploy.

  1. Review the configuration changes in the Terraform plan and confirm that you want to implement these changes.

  2. Enter the following command to apply the plan and create the infrastructure.

    terraform apply
  3. Enter yes to proceed. Terraform creates the architecture that is declared in the configuration files. For more information about the architecture, see the Target architecture section of this pattern.

DevOps engineer, Terraform
TaskDescriptionSkills required

Verify the infrastructure deployment.

  1. If you don't already have an Amazon EC2 instance in a public subnet in your AWS Region, create one. For instructions, see Launch your Linux instance or Launch your Windows instance. You will use this instance to test the connectivity from the AWS Region to the Wavelength Zone.

  2. Test the connectivity from the instance in the AWS Region to the instance in the Wavelength Zone. For instructions, see Test the connectivity in the Wavelength documentation.

AWS DevOps, DevOps engineer

(Optional) Clean up the infrastructure.

If you need to delete all of the resources that were provisioned by Terraform, do the following:

  1. Enter the following command.

    terraform destroy
  2. Enter yes to confirm.

DevOps engineer, Terraform

Troubleshooting

IssueSolution

Connectivity to Amazon EC2 instances in the AWS Region.

See Troubleshoot connecting to your Linux instance or Troubleshoot connecting to your Windows instance.

Connectivity to Amazon EC2 instances in the Wavelength Zone.

See Troubleshoot SSH or RDP connectivity to my EC2 instances launched in a Wavelength Zone.

Capacity in the Wavelength Zone.

See Quotas and considerations for Wavelength Zones.

Mobile or carrier connectivity from the carrier network to the AWS Region.

  1. Verify that the carrier gateway is operational. Do the following:

    1. Open the Amazon VPC console.

    2. In the navigation pane, choose Your VPCs.

    3. Select the VPC that contains the Wavelength Zone.

    4. On the Details pane, for Carrier gateway, confirm that the value is attached.

  2. Verify that any elastic IP addresses attached to instances in the Wavelength Zone are operational. Do the following:

    1. Open the Amazon EC2 console.

    2. In the navigation pane, choose Instances.

    3. Select the instance in the Wavelength Zone.

    4. Choose the Network tab.

    5. Confirm that the elastic network interface has an Elastic IP address attached.

  3. Contact the carrier network support team.

Related resources