Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ecs ]

describe-tasks

Description

Describes a specified task or tasks.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  describe-tasks
[--cluster <value>]
--tasks <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--cluster (string)

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to describe. If you do not specify a cluster, the default cluster is assumed.

--tasks (list)

A list of up to 100 task IDs or full ARN entries.

Syntax:

"string" "string" ...

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To describe a task

This example command provides a description of the specified task, using the task UUID as an identifier.

Command:

aws ecs describe-tasks --tasks c5cba4eb-5dad-405e-96db-71ef8eefe6a8

Output:

{
    "failures": [],
    "tasks": [
        {
            "taskArn": "arn:aws:ecs:<region>:<aws_account_id>:task/c5cba4eb-5dad-405e-96db-71ef8eefe6a8",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "ecs-demo"
                    }
                ]
            },
            "lastStatus": "RUNNING",
            "containerInstanceArn": "arn:aws:ecs:<region>:<aws_account_id>:container-instance/18f9eda5-27d7-4c19-b133-45adc516e8fb",
            "clusterArn": "arn:aws:ecs:<region>:<aws_account_id>:cluster/default",
            "desiredStatus": "RUNNING",
            "taskDefinitionArn": "arn:aws:ecs:<region>:<aws_account_id>:task-definition/amazon-ecs-sample:1",
            "startedBy": "ecs-svc/9223370608528463088",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:<region>:<aws_account_id>:container/7c01765b-c588-45b3-8290-4ba38bd6c5a6",
                    "taskArn": "arn:aws:ecs:<region>:<aws_account_id>:task/c5cba4eb-5dad-405e-96db-71ef8eefe6a8",
                    "lastStatus": "RUNNING",
                    "name": "ecs-demo",
                    "networkBindings": [
                        {
                            "bindIP": "0.0.0.0",
                            "containerPort": 80,
                            "hostPort": 80
                        }
                    ]
                }
            ]
        }
    ]
}

Output

tasks -> (list)

The list of tasks.

(structure)

Details on a task in a cluster.

taskArn -> (string)

The Amazon Resource Name (ARN) of the task.

clusterArn -> (string)

The ARN of the cluster that hosts the task.

taskDefinitionArn -> (string)

The ARN of the task definition that creates the task.

containerInstanceArn -> (string)

The ARN of the container instances that host the task.

overrides -> (structure)

One or more container overrides.

containerOverrides -> (list)

One or more container overrides sent to a task.

(structure)

The overrides that should be sent to a container.

name -> (string)

The name of the container that receives the override. This parameter is required if any override is specified.

command -> (list)

The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.

(string)

environment -> (list)

The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.

(structure)

A key and value pair object.

name -> (string)

The name of the key value pair. For environment variables, this is the name of the environment variable.

value -> (string)

The value of the key value pair. For environment variables, this is the value of the environment variable.

cpu -> (integer)

The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.

memory -> (integer)

The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.

memoryReservation -> (integer)

The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.

taskRoleArn -> (string)

The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.

executionRoleArn -> (string)

The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.

lastStatus -> (string)

The last known status of the task.

desiredStatus -> (string)

The desired status of the task.

cpu -> (string)

The number of CPU units used by the task. It can be expressed as an integer using CPU units, for example 1024 , or as a string using vCPUs, for example 1 vCPU or 1 vcpu , in a task definition but is converted to an integer indicating the CPU units when the task definition is registered.

If using the EC2 launch type, this field is optional. Supported values are between 128 CPU units (0.125 vCPUs) and 10240 CPU units (10 vCPUs).

If using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the memory parameter:

  • 256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
  • 512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
  • 1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
  • 2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
  • 4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)

memory -> (string)

The amount of memory (in MiB) used by the task. It can be expressed as an integer using MiB, for example 1024 , or as a string using GB, for example 1GB or 1 GB , in a task definition but is converted to an integer indicating the MiB when the task definition is registered.

If using the EC2 launch type, this field is optional.

If using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported 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)

containers -> (list)

The containers associated with the task.

(structure)

A Docker container that is part of a task.

containerArn -> (string)

The Amazon Resource Name (ARN) of the container.

taskArn -> (string)

The ARN of the task.

name -> (string)

The name of the container.

lastStatus -> (string)

The last known status of the container.

exitCode -> (integer)

The exit code returned from the container.

reason -> (string)

A short (255 max characters) human-readable string to provide additional details about a running or stopped container.

networkBindings -> (list)

The network bindings associated with the container.

(structure)

Details on the network bindings between a container and its host container instance. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of describe-tasks API responses.

bindIP -> (string)

The IP address that the container is bound to on the container instance.

containerPort -> (integer)

The port number on the container that is used with the network binding.

hostPort -> (integer)

The port number on the host that is used with the network binding.

protocol -> (string)

The protocol used for the network binding.

networkInterfaces -> (list)

The network interfaces associated with the container.

(structure)

An object representing the Elastic Network Interface for tasks that use the awsvpc network mode.

attachmentId -> (string)

The attachment ID for the network interface.

privateIpv4Address -> (string)

The private IPv4 address for the network interface.

ipv6Address -> (string)

The private IPv6 address for the network interface.

healthStatus -> (string)

The health status of the container. If health checks are not configured for this container in its task definition, then it reports health status as UNKNOWN .

startedBy -> (string)

The tag specified when a task is started. If the task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.

version -> (long)

The version counter for the task. Every time a task experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS task state with CloudWatch Events, you can compare the version of a task reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the task (inside the detail object) to verify that the version in your event stream is current.

stoppedReason -> (string)

The reason the task was stopped.

connectivity -> (string)

The connectivity status of a task.

connectivityAt -> (timestamp)

The Unix time stamp for when the task last went into CONNECTED status.

pullStartedAt -> (timestamp)

The Unix time stamp for when the container image pull began.

pullStoppedAt -> (timestamp)

The Unix time stamp for when the container image pull completed.

executionStoppedAt -> (timestamp)

The Unix time stamp for when the task execution stopped.

createdAt -> (timestamp)

The Unix time stamp for when the task was created (the task entered the PENDING state).

startedAt -> (timestamp)

The Unix time stamp for when the task started (the task transitioned from the PENDING state to the RUNNING state).

stoppingAt -> (timestamp)

The Unix time stamp for when the task will stop (transitions from the RUNNING state to STOPPED ).

stoppedAt -> (timestamp)

The Unix time stamp for when the task was stopped (the task transitioned from the RUNNING state to the STOPPED state).

group -> (string)

The name of the task group associated with the task.

launchType -> (string)

The launch type on which your task is running.

platformVersion -> (string)

The platform version on which your task is running. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide .

attachments -> (list)

The Elastic Network Adapter associated with the task if the task uses the awsvpc network mode.

(structure)

An object representing a container instance or task attachment.

id -> (string)

The unique identifier for the attachment.

type -> (string)

The type of the attachment, such as ElasticNetworkInterface .

status -> (string)

The status of the attachment. Valid values are PRECREATED , CREATED , ATTACHING , ATTACHED , DETACHING , DETACHED , and DELETED .

details -> (list)

Details of the attachment. For Elastic Network Interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.

(structure)

A key and value pair object.

name -> (string)

The name of the key value pair. For environment variables, this is the name of the environment variable.

value -> (string)

The value of the key value pair. For environment variables, this is the value of the environment variable.

healthStatus -> (string)

The health status for the task, which is determined by the health of the essential containers in the task. If all essential containers in the task are reporting as HEALTHY , then the task status also reports as HEALTHY . If any essential containers in the task are reporting as UNHEALTHY or UNKNOWN , then the task status also reports as UNHEALTHY or UNKNOWN , accordingly.

Note

The Amazon ECS container agent does not monitor or report on Docker health checks that are embedded in a container image (such as those specified in a parent image or from the image's Dockerfile) and not specified in the container definition. Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image.

failures -> (list)

Any failures associated with the call.

(structure)

A failed resource.

arn -> (string)

The Amazon Resource Name (ARN) of the failed resource.

reason -> (string)

The reason for the failure.