liveBook · Manning

ECS task definition

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

An ECS task definition is a configuration that specifies the containers, images, resource settings, environment variables, and networking required to run an ECS task.

An ECS task definition is the configuration ECS uses to run a task. It specifies one or more containers, including their image URLs, CPU and memory settings, environment variables, and network configuration. Containers in the same task run on the same host, allowing them to share local resources such as networking. section 18.3

A task definition commonly describes:

  • CPU and memory baselines and limits for the containers. section 18.3
  • Environment variables and network settings required by the application. section 18.3
  • IAM roles that separate execution permissions, such as downloading images and publishing logs, from application permissions, such as accessing S3. section 18.5

Web application on Fargate

A CloudFormation task definition can run an app image on port 3000, send logs through the AWS logs driver, and provide password, region, and bucket values as environment variables. Its task role can grant the container permission to list, read, write, and delete objects in an S3 bucket. An ECS service then launches tasks from the definition and registers them with a load balancer.

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Details container, resource, environment, network, logging, and IAM settings, but defers service scaling and deployment behavior.
Examples
Uses a CloudFormation web application with an app image, port 3000, logs, environment variables, and S3 permissions.
What it assumes
Assumes an ECS cluster exists before creating tasks, while introducing the task, service, and task-definition relationship.
What you can do after
Configure a containerized web application for ECS and connect its runtime permissions to AWS services.
How it connects
Connects clusters, tasks, services, containers, Fargate, IAM roles, load balancers, and S3.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.