terraform

Announcing Support for Amazon ECS Anywhere in the Terraform AWS Provider

The Terraform AWS provider now supports ECS Anywhere, a new capability in Amazon ECS that supports running and managing container-based applications on customers’ on-premises servers.

In partnership with Amazon Web Services (AWS), we are pleased to announce launch-day support for Amazon ECS Anywhere in the Terraform AWS Provider. ECS Anywhere is a new offering from Amazon ECS that allows users to run containerized workflows in a variety of environments.

»How It Works

Previously, ECS would use compute capacity in an AWS region, Local Zone, Wavelength Zone, or Outpost. With this launch, ECS extends its capabilities to include other compute capacity, such as customer-owned virtual machines or bare-metal servers, in on-premises environments — without requiring customers to install or operate container orchestration software.

ECS Anywhere simplifies on-premises container management so that there is no need to run, update, or maintain container orchestrators on-premises. With consistent tooling and governance, you can employ the same tools and APIs for all container-based applications regardless of operating environment. By using ECS Anywhere to manage your hybrid footprint, you can containerize and run applications in on-premises environments first and easily expand to the cloud whenever you're ready.

Additional information about this service can be found in Getting Started with ECS Anywhere from AWS, and the ECS Anywhere documentation.

»Configuring ECS Anywhere in the Terraform AWS Provider

To get started with ECS Anywhere in the Terraform AWS provider, you will need to add an additional property, EXTERNAL, to a new or existing aws_ecs_task_definition.

In order to try out this feature, you will need:

  • Terraform v0.12 or greater installed
  • The latest version of the Terraform AWS provider

The Terraform configuration below demonstrates how the Terraform AWS provider can be used to configure ECS Anywhere.

resource "aws_ecs_task_definition" "service" {  container_definitions    = jsonencode(    [      {        cpu          = 10        essential    = true        image        = "nginx"        memory       = 512        name         = "nginx"        portMappings = [          {            containerPort = 80            hostPort      = 80          },        ]      },    ]  ) family                   = "service" requires_compatibilities = ["EXTERNAL",]}

»Further Information

For more information on how to use this feature in Terraform, consult the provider documentation in the Terraform Registry. To report bugs or request enhancements for this feature, open an issue on the Terraform AWS Provider repository on GitHub. We would love to hear your feedback.

Sign up for the latest HashiCorp news

By submitting this form, you acknowledge and agree that HashiCorp will process your personal information in accordance with the Privacy Policy.