task_definitions
Creates, updates, deletes or gets a task_definition resource or lists task_definitions in a region
Overview
| Name | task_definitions |
| Type | Resource |
| Description | Registers a new task definition from the supplied You can specify a role for your task with the |
| Id | awscc.ecs.task_definitions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
task_role_arn | string | The short name or full Amazon Resource Name (ARN) of the IAMlong role that grants containers in the task permission to call AWS APIs on your behalf. For more information, see Amazon ECS Task Role in the Amazon Elastic Container Service Developer Guide.IAM roles for tasks on Windows require that the-EnableTaskIAMRole option is set when you launch the Amazon ECS-optimized Windows AMI. Your containers must also run some configuration code to use the feature. For more information, see Windows IAM roles for tasks in the Amazon Elastic Container Service Developer Guide.String validation is done on the ECS side. If an invalid string value is given for TaskRoleArn, it may cause the Cloudformation job to hang. |
ipc_mode | string | The IPC resource namespace to use for the containers in the task. The valid values are If the |
inference_accelerators | array | |
memory | string | The amount (in MiB) of memory used by the task.If your tasks runs on Amazon EC2 instances, you must specify either a task-level memory value or a container-level memory value. This field is optional and any value can be used. If a task-level memory value is specified, the container-level memory value is optional. For more information regarding container-level memory and memory reservation, see ContainerDefinition.If your tasks runs on FARGATElong, this field is required. You must use one of the following values. The value you choose determines your range of valid values for the cpu parameter.+ 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)+ 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)+ 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)+ Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)+ Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)+ Between 16 GB and 60 GB in 4 GB increments - Available cpu values: 8192 (8 vCPU)This option requires Linux platform 1.4.0 or later.+ Between 32GB and 120 GB in 8 GB increments - Available cpu values: 16384 (16 vCPU)This option requires Linux platform 1.4.0 or later. |
placement_constraints | array | An array of placement constraint objects to use for tasks.This parameter isn't supported for tasks run on FARGATElong. |
cpu | string | The number of If you're using the EC2 launch type or the external launch type, this field is optional. Supported values are between |
requires_compatibilities | array | The task launch types the task definition was validated against. The valid values are EC2, FARGATE, and EXTERNAL. For more information, see Amazon ECS launch types in the Amazon Elastic Container Service Developer Guide. |
network_mode | string | The Docker networking mode to use for the containers in the task. The valid values are For Amazon ECS tasks on Fargate, the |
pid_mode | string | The process namespace to use for the containers in the task. The valid values are If |
enable_fault_injection | boolean | Enables fault injection and allows for fault injection requests to be accepted from the task's containers. The default value is false. |
execution_role_arn | string | The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container agent permission to make AWS API calls on your behalf. For informationabout the required IAM roles for Amazon ECS, see IAM roles for Amazon ECS in the Amazon Elastic Container Service Developer Guide. |
runtime_platform | object | The operating system that your tasks definitions run on. A platform family is specified only for tasks using the Fargate launch type. |
proxy_configuration | object | The configuration details for the App Mesh proxy.Your Amazon ECS container instances require at least version 1.26.0 of the container agent and at least version 1.26.0-1 of theecs-init package to use a proxy configuration. If your container instances are launched from the Amazon ECS optimized AMI version 20190301 or later, they contain the required versions of the container agent and ecs-init. For more information, see Amazon ECS-optimized Linux AMI in the Amazon Elastic Container Service Developer Guide. |
volumes | array | The list of data volume definitions for the task. For more information, see Using data volumes in tasks in the Amazon Elastic Container Service Developer Guide.Thehost and sourcePath parameters aren't supported for tasks run on FARGATElong. |
container_definitions | array | A list of container definitions in JSON format that describe the different containers that make up your task. For more information about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service Developer Guide. |
family | string | The name of a family that this task definition is registered to. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.A family groups multiple versions of a task definition. Amazon ECS gives the first task definition that you registered to a family a revision number of 1. Amazon ECS gives sequential revision numbers to each task definition that you add.To use revision numbers when you update a task definition, specify this property. If you don't specify a value, CFNlong generates a new task definition each time that you update it. |
ephemeral_storage | object | The ephemeral storage settings to use for tasks run with the task definition. |
tags | array | The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists of a key and an optional value. You define both of them.The following basic restrictions apply to tags:+ Maximum number of tags per resource - 50 + For each resource, each tag key must be unique, and each tag key can have only one value. + Maximum key length - 128 Unicode characters in UTF-8 + Maximum value length - 256 Unicode characters in UTF-8 + If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. + Tag keys and values are case-sensitive. + Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit. |
task_definition_arn | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
task_definition_arn | string | |
region | string | AWS region. |
For more information, see AWS::ECS::TaskDefinition.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | task_definitions | INSERT | region |
delete_resource | task_definitions | DELETE | Identifier, region |
update_resource | task_definitions | UPDATE | Identifier, PatchDocument, region |
list_resources | task_definitions_list_only | SELECT | region |
get_resource | task_definitions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual task_definition.
SELECT
region,
task_role_arn,
ipc_mode,
inference_accelerators,
memory,
placement_constraints,
cpu,
requires_compatibilities,
network_mode,
pid_mode,
enable_fault_injection,
execution_role_arn,
runtime_platform,
proxy_configuration,
volumes,
container_definitions,
family,
ephemeral_storage,
tags,
task_definition_arn
FROM awscc.ecs.task_definitions
WHERE
region = '{{ region }}' AND
Identifier = '{{ task_definition_arn }}';
Lists all task_definitions in a region.
SELECT
region,
task_definition_arn
FROM awscc.ecs.task_definitions_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new task_definition resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ecs.task_definitions (
TaskRoleArn,
IpcMode,
InferenceAccelerators,
Memory,
PlacementConstraints,
Cpu,
RequiresCompatibilities,
NetworkMode,
PidMode,
EnableFaultInjection,
ExecutionRoleArn,
RuntimePlatform,
ProxyConfiguration,
Volumes,
ContainerDefinitions,
Family,
EphemeralStorage,
Tags,
region
)
SELECT
'{{ task_role_arn }}',
'{{ ipc_mode }}',
'{{ inference_accelerators }}',
'{{ memory }}',
'{{ placement_constraints }}',
'{{ cpu }}',
'{{ requires_compatibilities }}',
'{{ network_mode }}',
'{{ pid_mode }}',
'{{ enable_fault_injection }}',
'{{ execution_role_arn }}',
'{{ runtime_platform }}',
'{{ proxy_configuration }}',
'{{ volumes }}',
'{{ container_definitions }}',
'{{ family }}',
'{{ ephemeral_storage }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ecs.task_definitions (
TaskRoleArn,
IpcMode,
InferenceAccelerators,
Memory,
PlacementConstraints,
Cpu,
RequiresCompatibilities,
NetworkMode,
PidMode,
EnableFaultInjection,
ExecutionRoleArn,
RuntimePlatform,
ProxyConfiguration,
Volumes,
ContainerDefinitions,
Family,
EphemeralStorage,
Tags,
region
)
SELECT
'{{ task_role_arn }}',
'{{ ipc_mode }}',
'{{ inference_accelerators }}',
'{{ memory }}',
'{{ placement_constraints }}',
'{{ cpu }}',
'{{ requires_compatibilities }}',
'{{ network_mode }}',
'{{ pid_mode }}',
'{{ enable_fault_injection }}',
'{{ execution_role_arn }}',
'{{ runtime_platform }}',
'{{ proxy_configuration }}',
'{{ volumes }}',
'{{ container_definitions }}',
'{{ family }}',
'{{ ephemeral_storage }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: task_definition
props:
- name: task_role_arn
value: '{{ task_role_arn }}'
- name: ipc_mode
value: '{{ ipc_mode }}'
- name: inference_accelerators
value:
- device_type: '{{ device_type }}'
device_name: '{{ device_name }}'
- name: memory
value: '{{ memory }}'
- name: placement_constraints
value:
- type: '{{ type }}'
expression: '{{ expression }}'
- name: cpu
value: '{{ cpu }}'
- name: requires_compatibilities
value:
- '{{ requires_compatibilities[0] }}'
- name: network_mode
value: '{{ network_mode }}'
- name: pid_mode
value: '{{ pid_mode }}'
- name: enable_fault_injection
value: '{{ enable_fault_injection }}'
- name: execution_role_arn
value: '{{ execution_role_arn }}'
- name: runtime_platform
value:
operating_system_family: '{{ operating_system_family }}'
cpu_architecture: '{{ cpu_architecture }}'
- name: proxy_configuration
value:
proxy_configuration_properties:
- value: '{{ value }}'
name: '{{ name }}'
type: '{{ type }}'
container_name: '{{ container_name }}'
- name: volumes
value:
- e_fs_volume_configuration:
filesystem_id: '{{ filesystem_id }}'
transit_encryption: '{{ transit_encryption }}'
authorization_config:
iam: '{{ iam }}'
access_point_id: '{{ access_point_id }}'
root_directory: '{{ root_directory }}'
transit_encryption_port: '{{ transit_encryption_port }}'
host:
source_path: '{{ source_path }}'
configured_at_launch: '{{ configured_at_launch }}'
docker_volume_configuration:
driver_opts: {}
scope: '{{ scope }}'
autoprovision: '{{ autoprovision }}'
driver: '{{ driver }}'
labels: {}
f_sx_windows_file_server_volume_configuration:
authorization_config:
credentials_parameter: '{{ credentials_parameter }}'
domain: '{{ domain }}'
file_system_id: '{{ file_system_id }}'
root_directory: '{{ root_directory }}'
name: '{{ name }}'
- name: container_definitions
value:
- user: '{{ user }}'
secrets:
- value_from: '{{ value_from }}'
name: '{{ name }}'
memory: '{{ memory }}'
privileged: '{{ privileged }}'
health_check:
command:
- '{{ command[0] }}'
timeout: '{{ timeout }}'
retries: '{{ retries }}'
interval: '{{ interval }}'
start_period: '{{ start_period }}'
start_timeout: '{{ start_timeout }}'
volumes_from:
- read_only: '{{ read_only }}'
source_container: '{{ source_container }}'
cpu: '{{ cpu }}'
entry_point:
- '{{ entry_point[0] }}'
dns_servers:
- '{{ dns_servers[0] }}'
readonly_root_filesystem: '{{ readonly_root_filesystem }}'
image: '{{ image }}'
essential: '{{ essential }}'
log_configuration:
secret_options:
- null
options: {}
log_driver: '{{ log_driver }}'
resource_requirements:
- type: '{{ type }}'
value: '{{ value }}'
environment_files:
- type: '{{ type }}'
value: '{{ value }}'
name: '{{ name }}'
firelens_configuration:
options: {}
type: '{{ type }}'
docker_security_options:
- '{{ docker_security_options[0] }}'
system_controls:
- value: '{{ value }}'
namespace: '{{ namespace }}'
interactive: '{{ interactive }}'
dns_search_domains:
- '{{ dns_search_domains[0] }}'
credential_specs:
- '{{ credential_specs[0] }}'
ulimits:
- soft_limit: '{{ soft_limit }}'
hard_limit: '{{ hard_limit }}'
name: '{{ name }}'
stop_timeout: '{{ stop_timeout }}'
working_directory: '{{ working_directory }}'
memory_reservation: '{{ memory_reservation }}'
repository_credentials:
credentials_parameter: '{{ credentials_parameter }}'
extra_hosts:
- hostname: '{{ hostname }}'
ip_address: '{{ ip_address }}'
hostname: '{{ hostname }}'
linux_parameters:
capabilities:
add:
- '{{ add[0] }}'
drop:
- '{{ drop[0] }}'
swappiness: '{{ swappiness }}'
tmpfs:
- size: '{{ size }}'
container_path: '{{ container_path }}'
mount_options:
- '{{ mount_options[0] }}'
shared_memory_size: '{{ shared_memory_size }}'
devices:
- host_path: '{{ host_path }}'
permissions:
- '{{ permissions[0] }}'
container_path: '{{ container_path }}'
init_process_enabled: '{{ init_process_enabled }}'
max_swap: '{{ max_swap }}'
version_consistency: '{{ version_consistency }}'
restart_policy:
ignored_exit_codes:
- '{{ ignored_exit_codes[0] }}'
restart_attempt_period: '{{ restart_attempt_period }}'
enabled: '{{ enabled }}'
disable_networking: '{{ disable_networking }}'
pseudo_terminal: '{{ pseudo_terminal }}'
mount_points:
- read_only: '{{ read_only }}'
source_volume: '{{ source_volume }}'
container_path: '{{ container_path }}'
depends_on:
- condition: '{{ condition }}'
container_name: '{{ container_name }}'
docker_labels: {}
port_mappings:
- app_protocol: '{{ app_protocol }}'
container_port_range: '{{ container_port_range }}'
host_port: '{{ host_port }}'
container_port: '{{ container_port }}'
protocol: '{{ protocol }}'
name: '{{ name }}'
command:
- '{{ command[0] }}'
environment:
- null
links:
- '{{ links[0] }}'
- name: family
value: '{{ family }}'
- name: ephemeral_storage
value:
size_in_gi_b: '{{ size_in_gi_b }}'
- name: tags
value:
- value: '{{ value }}'
key: '{{ key }}'
UPDATE example
Use the following StackQL query and manifest file to update a task_definition resource, using stack-deploy.
/*+ update */
UPDATE awscc.ecs.task_definitions
SET PatchDocument = string('{{ {
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ task_definition_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ecs.task_definitions
WHERE
Identifier = '{{ task_definition_arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the task_definitions resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
ecs:DescribeTaskDefinition
ecs:RegisterTaskDefinition,
ecs:DescribeTaskDefinition,
ecs:TagResource,
iam:GetRole,
iam:PassRole
ecs:TagResource,
ecs:UntagResource,
ecs:ListTagsForResource,
ecs:DescribeTaskDefinition,
iam:GetRole,
iam:PassRole
ecs:ListTaskDefinitions,
ecs:DescribeTaskDefinition
ecs:DeregisterTaskDefinition,
ecs:DescribeTaskDefinition,
iam:GetRole,
iam:PassRole