tasks
Creates, updates, deletes, gets or lists a tasks resource.
Overview
| Name | tasks |
| Type | Resource |
| Id | aws.ecs.tasks |
Fields
The following fields are returned by SELECT queries:
- describe_tasks
- list_tasks
| Name | Datatype | Description |
|---|---|---|
failures | array | Any failures associated with the call. |
tasks | array | The list of tasks. |
| Name | Datatype | Description |
|---|---|---|
task_arn | string | The list of task ARN entries for the ListTasks request. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_tasks | select | region | 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. | |
list_tasks | select | region | Returns 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_change | exec | region | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- describe_tasks
- list_tasks
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
;
Returns 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.
SELECT
task_arn
FROM aws.ecs.tasks
WHERE region = '{{ region }}' -- required
;
Lifecycle Methods
- submit_task_state_change
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 }}"
}'
;