Amazon Elastic Container Service
Developer Guide (API Version 2014-11-13)

Amazon ECS Task Definitions

A task definition is required to run Docker containers in Amazon ECS. Some of the parameters you can specify in a task definition include:

  • Which Docker images to use with the containers in your task

  • How much CPU and memory to use with each container

  • Whether containers are linked together in a task

  • The Docker networking mode to use for the containers in your task

  • What (if any) ports from the container are mapped to the host container instance

  • Whether the task should continue to run if the container finishes or fails

  • The command the container should run when it is started

  • What (if any) environment variables should be passed to the container when it starts

  • Any data volumes that should be used with the containers in the task

  • What (if any) IAM role your tasks should use for permissions

You can define multiple containers and data volumes in a task definition. For a complete description of the parameters available in a task definition, see Task Definition Parameters.

Your entire application stack does not need to exist on a single task definition, and in most cases it should not. Your application can span multiple task definitions by combining related containers into their own task definitions, each representing a single component. For more information, see Application Architecture.