AWS Amazon ECS Task Definition

This page shows how to write Terraform and CloudFormation for Amazon ECS Task Definition and write them securely.

code-icon

Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.

get-started-button

Terraform Example (aws_ecs_task_definition)

Manages a revision of an ECS task definition to be used in aws_ecs_service.

Parameters

Example Usage (from GitHub)

github-iconstelligent/config-lint
resource "aws_ecs_task_definition" "container_definitions_environment_not_set" {
  family                = "foo"
  container_definitions = <<EOF
[
  {
    "name": "bar",
github-iconstelligent/config-lint
resource "aws_ecs_task_definition" "container_definitions_environment_not_set" {
  family                = "foo"
  container_definitions = <<EOF
[
  {
    "name": "bar",
github-iconkuromitsu0104/gadget-app
resource "aws_ecs_task_definition" "gadget-front-task" {
  family                   = "gadget-front-task"
  cpu                      = "512"
  memory                   = "1024"
  network_mode             = "awsvpc"
  requires_compatibilities = ["FARGATE"]
github-iconDaichiHoshina/go_react_app
resource "aws_ecs_task_definition" "front-task" {
  family                = "webapp-service"
  container_definitions = file("./container_definitions/service.json.tpl")

  execution_role_arn = data.terraform_remote_state.aws_iam.outputs.ecs_task_role_arn
  network_mode       = "bridge"

CloudFormation Example (AWS::ECS::TaskDefinition)

The AWS::ECS::TaskDefinition resource describes the container and volume definitions of an Amazon Elastic Container Service (Amazon ECS) task. You can specify which Docker images to use, the required resources, and other configurations related to launching the task definition through an Amazon ECS service or task.

Parameters

Frequently asked questions

What is AWS Amazon ECS Task Definition?

AWS Amazon ECS Task Definition is a resource for Amazon ECS of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon ECS Task Definition?

For Terraform, the stelligent/config-lint, stelligent/config-lint and kuromitsu0104/gadget-app source code examples are useful. See the Terraform Example section for further details.