AWS Fundamentals Logo
AWS Fundamentals
AWS::ECS::TaskDefinition

ECS TaskDefinition

Registers a new task definition from the supplied family and containerDefinitions. Optionally, you can add data volumes to your containers with the volumes parameter. For more information about task definition parameters and defaults, see [Amazon ECS Task Definitions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html) in the *Amazon Elastic Container Service Developer Guide*. You can specify a role for your task with the taskRoleArn parameter. When you specify a role for a task, its containers can then use the latest versions of the CLI or SDKs to make API requests to the AWS services that are specified in the policy that's associated with the role. For more information, see [IAM Roles for Tasks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html) in the *Amazon Elastic Container Service Developer Guide*. You can specify a Docker networking mode for the containers in your task definition with the networkMode parameter. If you specify the awsvpc network mode, the task is allocated an elastic network interface, and you must specify a [NetworkConfiguration](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_NetworkConfiguration.html) when you create a service or run a task with the task definition. For more information, see [Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html) in the *Amazon Elastic Container Service Developer Guide*. In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information, see [Signature Version 4 Signing Process](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) in the *General Reference*. You only need to learn how to sign HTTP requests if you intend to create them manually. When you use the [](https://docs.aws.amazon.com/cli/) or one of the [SDKs](https://docs.aws.amazon.com/tools/) to make requests to AWS, these tools automatically sign the requests for you, with the access key that you specify when you configure the tools. When you use these tools, you don't have to sign requests yourself.

Properties

18 configurable properties. Click a row to see details.

Filter:
PropertyTypeFlags
ContainerDefinitions
Array<ContainerDefinition>
Create-only
Cpu
string
Create-only
EnableFaultInjection
boolean
Create-only
EphemeralStorage
EphemeralStorage
Create-only
ExecutionRoleArn
string
Create-only
Family
string
Create-only
InferenceAccelerators
Array<InferenceAccelerator>
Create-onlyDeprecated
IpcMode
string
Create-only
Memory
string
Create-only
NetworkMode
string
Create-only
PidMode
string
Create-only
PlacementConstraints
Array<TaskDefinitionPlacementConstraint>
Create-only
ProxyConfiguration
ProxyConfiguration
Create-only
RequiresCompatibilities
Array<string>
Create-only
RuntimePlatform
RuntimePlatform
Create-only
Tags
Array<Tag>
TaskRoleArn
string
Create-only
Volumes
Array<Volume>
Create-only

Return Values

Values returned after the resource is created. Access these with Fn::GetAtt.

AttributeTypeDescription
TaskDefinitionArnstring-

Sample CloudFormation Template

A minimal template with required properties and common optional ones.

template.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample template for AWS::ECS::TaskDefinition

Resources:
  MyResource:
    Type: AWS::ECS::TaskDefinition
    Properties:
      Tags:
        - Key: Environment
          Value: Production

Required IAM Permissions

Permissions CloudFormation needs in your IAM role to manage this resource.

read

ecs:DescribeTaskDefinition

create

ecs:RegisterTaskDefinitionecs:DescribeTaskDefinitionecs:TagResourceiam:GetRoleiam:PassRole

update

ecs:TagResourceecs:UntagResourceecs:ListTagsForResourceecs:DescribeTaskDefinitioniam:GetRoleiam:PassRole

list

ecs:ListTaskDefinitionsecs:DescribeTaskDefinition

delete

ecs:DeregisterTaskDefinitionecs:DescribeTaskDefinitioniam:GetRoleiam:PassRole

Get the ECS Cheat Sheet

Everything you need to know about ECS on one page. HD quality, print-friendly.

Download Free Infographic

Quick Facts

ServiceECS
Properties19
Required0
TaggingSupported
Primary IDTaskDefinitionArn

Supported Operations

ReadCreateUpdateListDelete

Immutable After Creation

These properties cannot be changed after the resource is created. Updating them triggers a replacement.

FamilyContainerDefinitionsCpuEnableFaultInjectionExecutionRoleArnInferenceAcceleratorsMemoryNetworkModePlacementConstraintsProxyConfigurationRequiresCompatibilitiesRuntimePlatformTaskRoleArnVolumesPidModeIpcModeEphemeralStorage

External Links