CmdID

CmdID / aws / aws ecs

aws ecs describe-tasks

Describes a specified task or tasks. AWS CLI reference

2 examples 3 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To describe a single task tasks

The following describe-tasks example retrieves the details of a task in a cluster. You can specify the task by using either the ID or full ARN of the task. This example uses the full ARN of the task.

aws ecs describe-tasks --cluster MyCluster --tasks arn:aws:ecs:us-west-2:123456789012:task/MyCluster/4d590253bb114126b7afa7b58EXAMPLEIdentify
--clusterThe short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe.
--tasksA list of up to 100 task IDs or full ARN entries.
Its output, shortened
{
    "tasks": [
        {
            "attachments": [],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                }
            ],
            "availabilityZone": "us-west-2b",
            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
            "connectivity": "CONNECTED",
            "connectivityAt": "2021-08-11T12:21:26.681000-04:00",
            "containerInstanceArn": "arn:aws:ecs:us-west-2:123456789012:container-instance/test/025c7e2c5e054a6790a29fc1fEXAMPLE",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-west-2:123456789012:container/MyCluster/4d590253bb114126b7afa7b58eea9221/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
                    "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/MyCluster/4d590253bb114126b7afa7b58EXAMPLE",
                    "name": "simple-app",
                    "image": "httpd:2.4",
                    "runtimeId": "91251eed27db90006ad67b1a08187290869f216557717dd5c39b37c94EXAMPLE",
                    "lastStatus": "RUNNING",
                    "networkBindings": [
                        {
                            "bindIP": "0.0.0.0",
                            "containerPort": 80,
                            "hostPort": 80,
                            "protocol": "tcp"
                        }
… 36 more lines

For more information, see Amazon ECS Task Definitions in the Amazon ECS Developer Guide.

Example 2: To describe multiple tasks

The following describe-tasks example retrieves the details of multiple tasks in a cluster. You can specify the task by using either the ID or full ARN of the task. This example uses the full IDs of the tasks.

aws ecs describe-tasks --cluster MyCluster --tasks "74de0355a10a4f979ac495c14EXAMPLE" "d789e94343414c25b9f6bd59eEXAMPLE"Identify
--clusterThe short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe.
--tasksA list of up to 100 task IDs or full ARN entries.
Its output, shortened
{
    "tasks": [
        {
            "attachments": [
                {
                    "id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
                    "type": "ElasticNetworkInterface",
                    "status": "ATTACHED",
                    "details": [
                        {
                            "name": "subnetId",
                            "value": "subnet-0d0eab1bb3EXAMPLE"
                        },
                        {
                            "name": "networkInterfaceId",
                            "value": "eni-0fa40520aeEXAMPLE"
                        },
                        {
                            "name": "macAddress",
                            "value": "0e:89:76:28:07:b3"
                        },
                        {
                            "name": "privateDnsName",
                            "value": "ip-10-0-1-184.ec2.internal"
                        },
                        {
                            "name": "privateIPv4Address",
                            "value": "10.0.1.184"
                        }
                    ]
… 157 more lines

For more information, see Amazon ECS Task Definitions in the Amazon ECS Developer Guide.

Options

3 in the AWS CLI reference
--clusterThe short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe.
--includeSpecifies whether you want to see the resource tags for the task.
--tasksA list of up to 100 task IDs or full ARN entries.