Skip to main content

tasks

Creates, updates, deletes, gets or lists a tasks resource.

Overview

Nametasks
TypeResource
Idaws.ecs.tasks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
failuresarrayAny failures associated with the call.
tasksarrayThe list of tasks.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_tasksselectregionDescribes a specified task or tasks. Currently, stopped tasks appear in the returned results for at least one hour. If you have tasks with tags, and then delete the cluster, the tagged tasks are returned in the response. If you create a new cluster with the same name as the deleted cluster, the tagged tasks are not included in the response.
list_tasksselectregionReturns a list of tasks. You can filter the results by cluster, task definition family, container instance, launch type, what IAM principal started the task, or by the desired status of the task. Recently stopped tasks might appear in the returned results.
submit_task_state_changeexecregionThis action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent. Sent to acknowledge that a task changed states.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes a specified task or tasks. Currently, stopped tasks appear in the returned results for at least one hour. If you have tasks with tags, and then delete the cluster, the tagged tasks are returned in the response. If you create a new cluster with the same name as the deleted cluster, the tagged tasks are not included in the response.

SELECT
failures,
tasks
FROM aws.ecs.tasks
WHERE region = '{{ region }}' -- required
;

Lifecycle Methods

This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent. Sent to acknowledge that a task changed states.

EXEC aws.ecs.tasks.submit_task_state_change
@region='{{ region }}' --required
@@json=
'{
"cluster": "{{ cluster }}",
"task": "{{ task }}",
"status": "{{ status }}",
"reason": "{{ reason }}",
"containers": "{{ containers }}",
"attachments": "{{ attachments }}",
"managedAgents": "{{ managedAgents }}",
"pullStartedAt": "{{ pullStartedAt }}",
"pullStoppedAt": "{{ pullStoppedAt }}",
"executionStoppedAt": "{{ executionStoppedAt }}"
}'
;