CmdID

CmdID / aws / aws ecs

aws ecs stop-task

Stops a running task. AWS CLI reference

1 example 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

To stop a task

The following stop-task example stops the specified task from running in the default cluster.

aws ecs stop-task --task 666fdccc2e2d4b6894dd422f4eeee8f8Identify
--taskThefull Amazon Resource Name (ARN) of the task.
Its output, shortened
{
    "task": {
        "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/666fdccc2e2d4b6894dd422f4eeee8f8",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/default",
        "taskDefinitionArn": "arn:aws:ecs:us-west-2:123456789012:task-definition/sleep360:3",
        "containerInstanceArn": "arn:aws:ecs:us-west-2:123456789012:container-instance/default/765936fadbdd46b5991a4bd70c2a43d4",
        "overrides": {
            "containerOverrides": []
        },
        "lastStatus": "STOPPED",
        "desiredStatus": "STOPPED",
        "cpu": "128",
        "memory": "128",
        "containers": [],
        "version": 2,
        "stoppedReason": "Taskfailedtostart",
        "stopCode": "TaskFailedToStart",
        "connectivity": "CONNECTED",
        "connectivityAt": 1563421494.186,
        "pullStartedAt": 1563421494.252,
        "pullStoppedAt": 1563421496.252,
        "executionStoppedAt": 1563421497,
        "createdAt": 1563421494.186,
        "stoppingAt": 1563421497.252,
        "stoppedAt": 1563421497.252,
        "group": "family:sleep360",
        "launchType": "EC2",
        "attachments": [],
        "tags": []
    }
… 1 more line

For more information, see Amazon ECS standalone tasks 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 to stop.
--reasonAn optional message specified when a task is stopped.
--taskThefull Amazon Resource Name (ARN) of the task.