Amazon EC2 Container Service

2015/04/09 - Amazon EC2 Container Service - 5 new 11 updated api methods

ListServices (new) Link ¶

Lists the services that are running in a specified cluster.

Request Syntax

client.list_services(
    cluster='string',
    nextToken='string',
    maxResults=123
)
type cluster

string

param cluster

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

type nextToken

string

param nextToken

The nextToken value returned from a previous paginated ListServices request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

type maxResults

integer

param maxResults

The maximum number of container instance results returned by ListServices in paginated output. When this parameter is used, ListServices only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListServices request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListServices returns up to 100 results and a nextToken value if applicable.

rtype

dict

returns

Response Syntax

{
    'serviceArns': [
        'string',
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • serviceArns (list) --

      The list of full Amazon Resource Name (ARN) entries for each service associated with the specified cluster.

      • (string) --

    • nextToken (string) --

      The nextToken value to include in a future ListServices request. When the results of a ListServices request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

DescribeServices (new) Link ¶

Describes the specified services running in your cluster.

Request Syntax

client.describe_services(
    cluster='string',
    services=[
        'string',
    ]
)
type cluster

string

param cluster

The name of the cluster that hosts the service you want to describe.

type services

list

param services

[REQUIRED]

A list of services you want to describe.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'services': [
        {
            'serviceArn': 'string',
            'serviceName': 'string',
            'clusterArn': 'string',
            'loadBalancers': [
                {
                    'loadBalancerName': 'string',
                    'containerName': 'string',
                    'containerPort': 123
                },
            ],
            'status': 'string',
            'desiredCount': 123,
            'runningCount': 123,
            'pendingCount': 123,
            'taskDefinition': 'string',
            'deployments': [
                {
                    'id': 'string',
                    'status': 'string',
                    'taskDefinition': 'string',
                    'desiredCount': 123,
                    'pendingCount': 123,
                    'runningCount': 123,
                    'createdAt': datetime(2015, 1, 1),
                    'updatedAt': datetime(2015, 1, 1)
                },
            ],
            'roleArn': 'string',
            'events': [
                {
                    'id': 'string',
                    'createdAt': datetime(2015, 1, 1),
                    'message': 'string'
                },
            ]
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • services (list) --

      The list of services described.

      • (dict) --

        • serviceArn (string) --

          The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service .

        • serviceName (string) --

          A user-generated string that you can use to identify your service.

        • clusterArn (string) --

          The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

        • loadBalancers (list) --

          A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

          • (dict) --

            • loadBalancerName (string) --

              The name of the load balancer.

            • containerName (string) --

              The name of the container to associate with the load balancer.

            • containerPort (integer) --

              The port on the container to associate with the load balancer.

        • status (string) --

          The status of the service. The valid values are ACTIVE , DRAINING , or INACTIVE .

        • desiredCount (integer) --

          The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

        • runningCount (integer) --

          The number of tasks in the cluster that are in the RUNNING state.

        • pendingCount (integer) --

          The number of tasks in the cluster that are in the PENDING state.

        • taskDefinition (string) --

          The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

        • deployments (list) --

          The current state of deployments for the service.

          • (dict) --

            • id (string) --

              The ID of the deployment.

            • status (string) --

              The status of the deployment. Valid values are PRIMARY (for the most recent deployment), ACTIVE (for previous deployments that still have tasks running, but are being replaced with the PRIMARY deployment), and INACTIVE (for deployments that have been completely replaced).

            • taskDefinition (string) --

              The most recent task definition that was specified for the service to use.

            • desiredCount (integer) --

              The most recent desired count of tasks that was specified for the service to deploy and/or maintain.

            • pendingCount (integer) --

              The number of tasks in the deployment that are in the PENDING status.

            • runningCount (integer) --

              The number of tasks in the deployment that are in the RUNNING status.

            • createdAt (datetime) --

              The Unix time in seconds and milliseconds when the service was created.

            • updatedAt (datetime) --

              The Unix time in seconds and milliseconds when the service was last updated.

        • roleArn (string) --

          The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

        • events (list) --

          The event stream for your service. A maximum of 100 of the latest events are displayed.

          • (dict) --

            • id (string) --

              The ID string of the event.

            • createdAt (datetime) --

              The Unix time in seconds and milliseconds when the event was triggered.

            • message (string) --

              The event message.

    • failures (list) --

      Any failures associated with the call.

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

UpdateService (new) Link ¶

Modify the desired count or task definition used in a service.

You can add to or subtract from the number of instantiations of a task definition in a service by specifying the cluster that the service is running in and a new desiredCount parameter.

You can use UpdateService to modify your task definition and deploy a new version of your service, one task at a time. If you modify the task definition with UpdateService , Amazon ECS spawns a task with the new version of the task definition and then stops an old task after the new version is running. Because UpdateService starts a new version of the task before stopping an old version, your cluster must have capacity to support one more instantiation of the task when UpdateService is run. If your cluster cannot support another instantiation of the task used in your service, you can reduce the desired count of your service by one before modifying the task definition.

Request Syntax

client.update_service(
    cluster='string',
    service='string',
    desiredCount=123,
    taskDefinition='string'
)
type cluster

string

param cluster

The short name or full Amazon Resource Name (ARN) of the cluster that your service is running on. If you do not specify a cluster, the default cluster is assumed.

type service

string

param service

[REQUIRED]

The name of the service that you want to update.

type desiredCount

integer

param desiredCount

The number of instantiations of the task that you would like to place and keep running in your service.

type taskDefinition

string

param taskDefinition

The family and revision ( family:revision ) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service. If you modify the task definition with UpdateService , Amazon ECS spawns a task with the new version of the task definition and then stops an old task after the new version is running.

rtype

dict

returns

Response Syntax

{
    'service': {
        'serviceArn': 'string',
        'serviceName': 'string',
        'clusterArn': 'string',
        'loadBalancers': [
            {
                'loadBalancerName': 'string',
                'containerName': 'string',
                'containerPort': 123
            },
        ],
        'status': 'string',
        'desiredCount': 123,
        'runningCount': 123,
        'pendingCount': 123,
        'taskDefinition': 'string',
        'deployments': [
            {
                'id': 'string',
                'status': 'string',
                'taskDefinition': 'string',
                'desiredCount': 123,
                'pendingCount': 123,
                'runningCount': 123,
                'createdAt': datetime(2015, 1, 1),
                'updatedAt': datetime(2015, 1, 1)
            },
        ],
        'roleArn': 'string',
        'events': [
            {
                'id': 'string',
                'createdAt': datetime(2015, 1, 1),
                'message': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • service (dict) --

      The full description of your service following the update call.

      • serviceArn (string) --

        The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service .

      • serviceName (string) --

        A user-generated string that you can use to identify your service.

      • clusterArn (string) --

        The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

      • loadBalancers (list) --

        A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

        • (dict) --

          • loadBalancerName (string) --

            The name of the load balancer.

          • containerName (string) --

            The name of the container to associate with the load balancer.

          • containerPort (integer) --

            The port on the container to associate with the load balancer.

      • status (string) --

        The status of the service. The valid values are ACTIVE , DRAINING , or INACTIVE .

      • desiredCount (integer) --

        The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

      • runningCount (integer) --

        The number of tasks in the cluster that are in the RUNNING state.

      • pendingCount (integer) --

        The number of tasks in the cluster that are in the PENDING state.

      • taskDefinition (string) --

        The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

      • deployments (list) --

        The current state of deployments for the service.

        • (dict) --

          • id (string) --

            The ID of the deployment.

          • status (string) --

            The status of the deployment. Valid values are PRIMARY (for the most recent deployment), ACTIVE (for previous deployments that still have tasks running, but are being replaced with the PRIMARY deployment), and INACTIVE (for deployments that have been completely replaced).

          • taskDefinition (string) --

            The most recent task definition that was specified for the service to use.

          • desiredCount (integer) --

            The most recent desired count of tasks that was specified for the service to deploy and/or maintain.

          • pendingCount (integer) --

            The number of tasks in the deployment that are in the PENDING status.

          • runningCount (integer) --

            The number of tasks in the deployment that are in the RUNNING status.

          • createdAt (datetime) --

            The Unix time in seconds and milliseconds when the service was created.

          • updatedAt (datetime) --

            The Unix time in seconds and milliseconds when the service was last updated.

      • roleArn (string) --

        The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

      • events (list) --

        The event stream for your service. A maximum of 100 of the latest events are displayed.

        • (dict) --

          • id (string) --

            The ID string of the event.

          • createdAt (datetime) --

            The Unix time in seconds and milliseconds when the event was triggered.

          • message (string) --

            The event message.

CreateService (new) Link ¶

Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount , Amazon ECS will spawn another instantiation of the task in the specified cluster.

Request Syntax

client.create_service(
    cluster='string',
    serviceName='string',
    taskDefinition='string',
    loadBalancers=[
        {
            'loadBalancerName': 'string',
            'containerName': 'string',
            'containerPort': 123
        },
    ],
    desiredCount=123,
    clientToken='string',
    role='string'
)
type cluster

string

param cluster

The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your service on. If you do not specify a cluster, the default cluster is assumed.

type serviceName

string

param serviceName

[REQUIRED]

The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

type taskDefinition

string

param taskDefinition

The family and revision ( family:revision ) or full Amazon Resource Name (ARN) of the task definition that you want to run in your service.

type loadBalancers

list

param loadBalancers

A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

  • (dict) --

    • loadBalancerName (string) --

      The name of the load balancer.

    • containerName (string) --

      The name of the container to associate with the load balancer.

    • containerPort (integer) --

      The port on the container to associate with the load balancer.

type desiredCount

integer

param desiredCount

The number of instantiations of the specified task definition that you would like to place and keep running on your cluster.

type clientToken

string

param clientToken

Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 64 ASCII characters are allowed.

type role

string

param role

The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.

rtype

dict

returns

Response Syntax

{
    'service': {
        'serviceArn': 'string',
        'serviceName': 'string',
        'clusterArn': 'string',
        'loadBalancers': [
            {
                'loadBalancerName': 'string',
                'containerName': 'string',
                'containerPort': 123
            },
        ],
        'status': 'string',
        'desiredCount': 123,
        'runningCount': 123,
        'pendingCount': 123,
        'taskDefinition': 'string',
        'deployments': [
            {
                'id': 'string',
                'status': 'string',
                'taskDefinition': 'string',
                'desiredCount': 123,
                'pendingCount': 123,
                'runningCount': 123,
                'createdAt': datetime(2015, 1, 1),
                'updatedAt': datetime(2015, 1, 1)
            },
        ],
        'roleArn': 'string',
        'events': [
            {
                'id': 'string',
                'createdAt': datetime(2015, 1, 1),
                'message': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • service (dict) --

      The full description of your service following the create call.

      • serviceArn (string) --

        The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service .

      • serviceName (string) --

        A user-generated string that you can use to identify your service.

      • clusterArn (string) --

        The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

      • loadBalancers (list) --

        A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

        • (dict) --

          • loadBalancerName (string) --

            The name of the load balancer.

          • containerName (string) --

            The name of the container to associate with the load balancer.

          • containerPort (integer) --

            The port on the container to associate with the load balancer.

      • status (string) --

        The status of the service. The valid values are ACTIVE , DRAINING , or INACTIVE .

      • desiredCount (integer) --

        The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

      • runningCount (integer) --

        The number of tasks in the cluster that are in the RUNNING state.

      • pendingCount (integer) --

        The number of tasks in the cluster that are in the PENDING state.

      • taskDefinition (string) --

        The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

      • deployments (list) --

        The current state of deployments for the service.

        • (dict) --

          • id (string) --

            The ID of the deployment.

          • status (string) --

            The status of the deployment. Valid values are PRIMARY (for the most recent deployment), ACTIVE (for previous deployments that still have tasks running, but are being replaced with the PRIMARY deployment), and INACTIVE (for deployments that have been completely replaced).

          • taskDefinition (string) --

            The most recent task definition that was specified for the service to use.

          • desiredCount (integer) --

            The most recent desired count of tasks that was specified for the service to deploy and/or maintain.

          • pendingCount (integer) --

            The number of tasks in the deployment that are in the PENDING status.

          • runningCount (integer) --

            The number of tasks in the deployment that are in the RUNNING status.

          • createdAt (datetime) --

            The Unix time in seconds and milliseconds when the service was created.

          • updatedAt (datetime) --

            The Unix time in seconds and milliseconds when the service was last updated.

      • roleArn (string) --

        The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

      • events (list) --

        The event stream for your service. A maximum of 100 of the latest events are displayed.

        • (dict) --

          • id (string) --

            The ID string of the event.

          • createdAt (datetime) --

            The Unix time in seconds and milliseconds when the event was triggered.

          • message (string) --

            The event message.

DeleteService (new) Link ¶

Deletes a specified service within a cluster.

Request Syntax

client.delete_service(
    cluster='string',
    service='string'
)
type cluster

string

param cluster

The name of the cluster that hosts the service you want to delete.

type service

string

param service

[REQUIRED]

The name of the service you want to delete.

rtype

dict

returns

Response Syntax

{
    'service': {
        'serviceArn': 'string',
        'serviceName': 'string',
        'clusterArn': 'string',
        'loadBalancers': [
            {
                'loadBalancerName': 'string',
                'containerName': 'string',
                'containerPort': 123
            },
        ],
        'status': 'string',
        'desiredCount': 123,
        'runningCount': 123,
        'pendingCount': 123,
        'taskDefinition': 'string',
        'deployments': [
            {
                'id': 'string',
                'status': 'string',
                'taskDefinition': 'string',
                'desiredCount': 123,
                'pendingCount': 123,
                'runningCount': 123,
                'createdAt': datetime(2015, 1, 1),
                'updatedAt': datetime(2015, 1, 1)
            },
        ],
        'roleArn': 'string',
        'events': [
            {
                'id': 'string',
                'createdAt': datetime(2015, 1, 1),
                'message': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • service (dict) --

      • serviceArn (string) --

        The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service .

      • serviceName (string) --

        A user-generated string that you can use to identify your service.

      • clusterArn (string) --

        The Amazon Resource Name (ARN) of the of the cluster that hosts the service.

      • loadBalancers (list) --

        A list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

        • (dict) --

          • loadBalancerName (string) --

            The name of the load balancer.

          • containerName (string) --

            The name of the container to associate with the load balancer.

          • containerPort (integer) --

            The port on the container to associate with the load balancer.

      • status (string) --

        The status of the service. The valid values are ACTIVE , DRAINING , or INACTIVE .

      • desiredCount (integer) --

        The desired number of instantiations of the task definition to keep running on the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

      • runningCount (integer) --

        The number of tasks in the cluster that are in the RUNNING state.

      • pendingCount (integer) --

        The number of tasks in the cluster that are in the PENDING state.

      • taskDefinition (string) --

        The task definition to use for tasks in the service. This value is specified when the service is created with CreateService, and it can be modified with UpdateService.

      • deployments (list) --

        The current state of deployments for the service.

        • (dict) --

          • id (string) --

            The ID of the deployment.

          • status (string) --

            The status of the deployment. Valid values are PRIMARY (for the most recent deployment), ACTIVE (for previous deployments that still have tasks running, but are being replaced with the PRIMARY deployment), and INACTIVE (for deployments that have been completely replaced).

          • taskDefinition (string) --

            The most recent task definition that was specified for the service to use.

          • desiredCount (integer) --

            The most recent desired count of tasks that was specified for the service to deploy and/or maintain.

          • pendingCount (integer) --

            The number of tasks in the deployment that are in the PENDING status.

          • runningCount (integer) --

            The number of tasks in the deployment that are in the RUNNING status.

          • createdAt (datetime) --

            The Unix time in seconds and milliseconds when the service was created.

          • updatedAt (datetime) --

            The Unix time in seconds and milliseconds when the service was last updated.

      • roleArn (string) --

        The Amazon Resource Name (ARN) of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with a load balancer.

      • events (list) --

        The event stream for your service. A maximum of 100 of the latest events are displayed.

        • (dict) --

          • id (string) --

            The ID string of the event.

          • createdAt (datetime) --

            The Unix time in seconds and milliseconds when the event was triggered.

          • message (string) --

            The event message.

CreateCluster (updated) Link ¶
Changes (response)
{'cluster': {'pendingTasksCount': 'integer',
             'registeredContainerInstancesCount': 'integer',
             'runningTasksCount': 'integer'}}

Creates a new Amazon ECS cluster. By default, your account will receive a default cluster when you launch your first container instance. However, you can create your own cluster with a unique name with the CreateCluster action.

Request Syntax

client.create_cluster(
    clusterName='string'
)
type clusterName

string

param clusterName

The name of your cluster. If you do not specify a name for your cluster, you will create a cluster named default . Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

rtype

dict

returns

Response Syntax

{
    'cluster': {
        'clusterArn': 'string',
        'clusterName': 'string',
        'status': 'string',
        'registeredContainerInstancesCount': 123,
        'runningTasksCount': 123,
        'pendingTasksCount': 123
    }
}

Response Structure

  • (dict) --

    • cluster (dict) --

      The full description of your new cluster.

      • clusterArn (string) --

        The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region :012345678910 :cluster/test .

      • clusterName (string) --

        A user-generated string that you can use to identify your cluster.

      • status (string) --

        The status of the cluster. The valid values are ACTIVE or INACTIVE . ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.

      • registeredContainerInstancesCount (integer) --

        The number of container instances registered into the cluster.

      • runningTasksCount (integer) --

        The number of tasks in the cluster that are in the RUNNING state.

      • pendingTasksCount (integer) --

        The number of tasks in the cluster that are in the PENDING state.

DeleteCluster (updated) Link ¶
Changes (response)
{'cluster': {'pendingTasksCount': 'integer',
             'registeredContainerInstancesCount': 'integer',
             'runningTasksCount': 'integer'}}

Deletes the specified cluster. You must deregister all container instances from this cluster before you may delete it. You can list the container instances in a cluster with ListContainerInstances and deregister them with DeregisterContainerInstance.

Request Syntax

client.delete_cluster(
    cluster='string'
)
type cluster

string

param cluster

[REQUIRED]

The short name or full Amazon Resource Name (ARN) of the cluster that you want to delete.

rtype

dict

returns

Response Syntax

{
    'cluster': {
        'clusterArn': 'string',
        'clusterName': 'string',
        'status': 'string',
        'registeredContainerInstancesCount': 123,
        'runningTasksCount': 123,
        'pendingTasksCount': 123
    }
}

Response Structure

  • (dict) --

    • cluster (dict) --

      The full description of the deleted cluster.

      • clusterArn (string) --

        The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region :012345678910 :cluster/test .

      • clusterName (string) --

        A user-generated string that you can use to identify your cluster.

      • status (string) --

        The status of the cluster. The valid values are ACTIVE or INACTIVE . ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.

      • registeredContainerInstancesCount (integer) --

        The number of container instances registered into the cluster.

      • runningTasksCount (integer) --

        The number of tasks in the cluster that are in the RUNNING state.

      • pendingTasksCount (integer) --

        The number of tasks in the cluster that are in the PENDING state.

DeregisterContainerInstance (updated) Link ¶
Changes (response)
{'containerInstance': {'pendingTasksCount': 'integer',
                       'runningTasksCount': 'integer'}}

Deregisters an Amazon ECS container instance from the specified cluster. This instance will no longer be available to run tasks.

Request Syntax

client.deregister_container_instance(
    cluster='string',
    containerInstance='string',
    force=True|False
)
type cluster

string

param cluster

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

type containerInstance

string

param containerInstance

[REQUIRED]

The container instance UUID or full Amazon Resource Name (ARN) of the container instance you want to deregister. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_UUID .

type force

boolean

param force

Force the deregistration of the container instance. You can use the force parameter if you have several tasks running on a container instance and you don't want to run StopTask for each task before deregistering the container instance.

rtype

dict

returns

Response Syntax

{
    'containerInstance': {
        'containerInstanceArn': 'string',
        'ec2InstanceId': 'string',
        'remainingResources': [
            {
                'name': 'string',
                'type': 'string',
                'doubleValue': 123.0,
                'longValue': 123,
                'integerValue': 123,
                'stringSetValue': [
                    'string',
                ]
            },
        ],
        'registeredResources': [
            {
                'name': 'string',
                'type': 'string',
                'doubleValue': 123.0,
                'longValue': 123,
                'integerValue': 123,
                'stringSetValue': [
                    'string',
                ]
            },
        ],
        'status': 'string',
        'agentConnected': True|False,
        'runningTasksCount': 123,
        'pendingTasksCount': 123
    }
}

Response Structure

  • (dict) --

    • containerInstance (dict) --

      An Amazon EC2 instance that is running the Amazon ECS agent and has been registered with a cluster.

      • containerInstanceArn (string) --

        The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_UUID .

      • ec2InstanceId (string) --

        The Amazon EC2 instance ID of the container instance.

      • remainingResources (list) --

        The remaining resources of the container instance that are available for new tasks.

        • (dict) --

          Describes the resources available for a container instance.

          • name (string) --

            The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

          • type (string) --

            The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

          • doubleValue (float) --

            When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

          • longValue (integer) --

            When the longValue type is set, the value of the resource must be an extended precision floating-point type.

          • integerValue (integer) --

            When the integerValue type is set, the value of the resource must be an integer.

          • stringSetValue (list) --

            When the stringSetValue type is set, the value of the resource must be a string type.

            • (string) --

      • registeredResources (list) --

        The registered resources on the container instance that are in use by current tasks.

        • (dict) --

          Describes the resources available for a container instance.

          • name (string) --

            The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

          • type (string) --

            The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

          • doubleValue (float) --

            When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

          • longValue (integer) --

            When the longValue type is set, the value of the resource must be an extended precision floating-point type.

          • integerValue (integer) --

            When the integerValue type is set, the value of the resource must be an integer.

          • stringSetValue (list) --

            When the stringSetValue type is set, the value of the resource must be a string type.

            • (string) --

      • status (string) --

        The status of the container instance. The valid values are ACTIVE or INACTIVE . ACTIVE indicates that the container instance can accept tasks.

      • agentConnected (boolean) --

        This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false , and instances without a connected agent cannot accept placement request.

      • runningTasksCount (integer) --

        The number of tasks on the container instance that are in the RUNNING status.

      • pendingTasksCount (integer) --

        The number of tasks on the container instance that are in the PENDING status.

DescribeClusters (updated) Link ¶
Changes (response)
{'clusters': {'pendingTasksCount': 'integer',
              'registeredContainerInstancesCount': 'integer',
              'runningTasksCount': 'integer'}}

Describes one or more of your clusters.

Request Syntax

client.describe_clusters(
    clusters=[
        'string',
    ]
)
type clusters

list

param clusters

A space-separated list of cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'clusters': [
        {
            'clusterArn': 'string',
            'clusterName': 'string',
            'status': 'string',
            'registeredContainerInstancesCount': 123,
            'runningTasksCount': 123,
            'pendingTasksCount': 123
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • clusters (list) --

      The list of clusters.

      • (dict) --

        A regional grouping of one or more container instances on which you can run task requests. Each account receives a default cluster the first time you use the Amazon ECS service, but you may also create other clusters. Clusters may contain more than one instance type simultaneously.

        Warning

        During the preview, each account is limited to two clusters.

        • clusterArn (string) --

          The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region :012345678910 :cluster/test .

        • clusterName (string) --

          A user-generated string that you can use to identify your cluster.

        • status (string) --

          The status of the cluster. The valid values are ACTIVE or INACTIVE . ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.

        • registeredContainerInstancesCount (integer) --

          The number of container instances registered into the cluster.

        • runningTasksCount (integer) --

          The number of tasks in the cluster that are in the RUNNING state.

        • pendingTasksCount (integer) --

          The number of tasks in the cluster that are in the PENDING state.

    • failures (list) --

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

DescribeContainerInstances (updated) Link ¶
Changes (response)
{'containerInstances': {'pendingTasksCount': 'integer',
                        'runningTasksCount': 'integer'}}

Describes Amazon EC2 Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested.

Request Syntax

client.describe_container_instances(
    cluster='string',
    containerInstances=[
        'string',
    ]
)
type cluster

string

param cluster

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

type containerInstances

list

param containerInstances

[REQUIRED]

A space-separated list of container instance UUIDs or full Amazon Resource Name (ARN) entries.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'containerInstances': [
        {
            'containerInstanceArn': 'string',
            'ec2InstanceId': 'string',
            'remainingResources': [
                {
                    'name': 'string',
                    'type': 'string',
                    'doubleValue': 123.0,
                    'longValue': 123,
                    'integerValue': 123,
                    'stringSetValue': [
                        'string',
                    ]
                },
            ],
            'registeredResources': [
                {
                    'name': 'string',
                    'type': 'string',
                    'doubleValue': 123.0,
                    'longValue': 123,
                    'integerValue': 123,
                    'stringSetValue': [
                        'string',
                    ]
                },
            ],
            'status': 'string',
            'agentConnected': True|False,
            'runningTasksCount': 123,
            'pendingTasksCount': 123
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • containerInstances (list) --

      The list of container instances.

      • (dict) --

        An Amazon EC2 instance that is running the Amazon ECS agent and has been registered with a cluster.

        • containerInstanceArn (string) --

          The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_UUID .

        • ec2InstanceId (string) --

          The Amazon EC2 instance ID of the container instance.

        • remainingResources (list) --

          The remaining resources of the container instance that are available for new tasks.

          • (dict) --

            Describes the resources available for a container instance.

            • name (string) --

              The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

            • type (string) --

              The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

            • doubleValue (float) --

              When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

            • longValue (integer) --

              When the longValue type is set, the value of the resource must be an extended precision floating-point type.

            • integerValue (integer) --

              When the integerValue type is set, the value of the resource must be an integer.

            • stringSetValue (list) --

              When the stringSetValue type is set, the value of the resource must be a string type.

              • (string) --

        • registeredResources (list) --

          The registered resources on the container instance that are in use by current tasks.

          • (dict) --

            Describes the resources available for a container instance.

            • name (string) --

              The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

            • type (string) --

              The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

            • doubleValue (float) --

              When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

            • longValue (integer) --

              When the longValue type is set, the value of the resource must be an extended precision floating-point type.

            • integerValue (integer) --

              When the integerValue type is set, the value of the resource must be an integer.

            • stringSetValue (list) --

              When the stringSetValue type is set, the value of the resource must be a string type.

              • (string) --

        • status (string) --

          The status of the container instance. The valid values are ACTIVE or INACTIVE . ACTIVE indicates that the container instance can accept tasks.

        • agentConnected (boolean) --

          This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false , and instances without a connected agent cannot accept placement request.

        • runningTasksCount (integer) --

          The number of tasks on the container instance that are in the RUNNING status.

        • pendingTasksCount (integer) --

          The number of tasks on the container instance that are in the PENDING status.

    • failures (list) --

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

DescribeTasks (updated) Link ¶
Changes (response)
{'tasks': {'startedBy': 'string'}}

Describes a specified task or tasks.

Request Syntax

client.describe_tasks(
    cluster='string',
    tasks=[
        'string',
    ]
)
type cluster

string

param cluster

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

type tasks

list

param tasks

[REQUIRED]

A space-separated list of task UUIDs or full Amazon Resource Name (ARN) entries.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'tasks': [
        {
            'taskArn': 'string',
            'clusterArn': 'string',
            'taskDefinitionArn': 'string',
            'containerInstanceArn': 'string',
            'overrides': {
                'containerOverrides': [
                    {
                        'name': 'string',
                        'command': [
                            'string',
                        ]
                    },
                ]
            },
            'lastStatus': 'string',
            'desiredStatus': 'string',
            'containers': [
                {
                    'containerArn': 'string',
                    'taskArn': 'string',
                    'name': 'string',
                    'lastStatus': 'string',
                    'exitCode': 123,
                    'reason': 'string',
                    'networkBindings': [
                        {
                            'bindIP': 'string',
                            'containerPort': 123,
                            'hostPort': 123
                        },
                    ]
                },
            ],
            'startedBy': 'string'
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • tasks (list) --

      The list of tasks.

      • (dict) --

        • taskArn (string) --

          The Amazon Resource Name (ARN) of the task.

        • clusterArn (string) --

          The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

        • taskDefinitionArn (string) --

          The Amazon Resource Name (ARN) of the of the task definition that creates the task.

        • containerInstanceArn (string) --

          The Amazon Resource Name (ARN) of the container instances that host the task.

        • overrides (dict) --

          One or more container overrides.

          • containerOverrides (list) --

            One or more container overrides sent to a task.

            • (dict) --

              The name of a container in a task definition and the command it should run instead of its default.

              • name (string) --

                The name of the container that receives the override.

              • command (list) --

                The command to send to the container that overrides the default command from the Docker image or the task definition.

                • (string) --

        • lastStatus (string) --

          The last known status of the task.

        • desiredStatus (string) --

          The desired status of the task.

        • containers (list) --

          The containers associated with the task.

          • (dict) --

            • containerArn (string) --

              The Amazon Resource Name (ARN) of the container.

            • taskArn (string) --

              The Amazon Resource Name (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 detail about a running or stopped container.

            • networkBindings (list) --

              • (dict) --

                • 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 be used with the network binding.

                • hostPort (integer) --

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

        • startedBy (string) --

    • failures (list) --

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

ListTasks (updated) Link ¶
Changes (request)
{'serviceName': 'string', 'startedBy': 'string'}

Returns a list of tasks for a specified cluster. You can filter the results by family name or by a particular container instance with the family and containerInstance parameters.

Request Syntax

client.list_tasks(
    cluster='string',
    containerInstance='string',
    family='string',
    nextToken='string',
    maxResults=123,
    startedBy='string',
    serviceName='string'
)
type cluster

string

param cluster

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

type containerInstance

string

param containerInstance

The container instance UUID or full Amazon Resource Name (ARN) of the container instance that you want to filter the ListTasks results with. Specifying a containerInstance will limit the results to tasks that belong to that container instance.

type family

string

param family

The name of the family that you want to filter the ListTasks results with. Specifying a family will limit the results to tasks that belong to that family.

type nextToken

string

param nextToken

The nextToken value returned from a previous paginated ListTasks request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

type maxResults

integer

param maxResults

The maximum number of task results returned by ListTasks in paginated output. When this parameter is used, ListTasks only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListTasks request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListTasks returns up to 100 results and a nextToken value if applicable.

type startedBy

string

param startedBy

type serviceName

string

param serviceName

The name of the service that you want to filter the ListTasks results with. Specifying a serviceName will limit the results to tasks that belong to that service.

rtype

dict

returns

Response Syntax

{
    'taskArns': [
        'string',
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • taskArns (list) --

      The list of task Amazon Resource Name (ARN) entries for the ListTasks request.

      • (string) --

    • nextToken (string) --

      The nextToken value to include in a future ListTasks request. When the results of a ListTasks request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

RegisterContainerInstance (updated) Link ¶
Changes (request, response)
Request
{'versionInfo': {'agentHash': 'string',
                 'agentVersion': 'string',
                 'dockerVersion': 'string'}}
Response
{'containerInstance': {'pendingTasksCount': 'integer',
                       'runningTasksCount': 'integer'}}

Note

This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent.

Registers an Amazon EC2 instance into the specified cluster. This instance will become available to place containers on.

Request Syntax

client.register_container_instance(
    cluster='string',
    instanceIdentityDocument='string',
    instanceIdentityDocumentSignature='string',
    totalResources=[
        {
            'name': 'string',
            'type': 'string',
            'doubleValue': 123.0,
            'longValue': 123,
            'integerValue': 123,
            'stringSetValue': [
                'string',
            ]
        },
    ],
    versionInfo={
        'agentVersion': 'string',
        'agentHash': 'string',
        'dockerVersion': 'string'
    }
)
type cluster

string

param cluster

The short name or full Amazon Resource Name (ARN) of the cluster that you want to register your container instance with. If you do not specify a cluster, the default cluster is assumed..

type instanceIdentityDocument

string

param instanceIdentityDocument

type instanceIdentityDocumentSignature

string

param instanceIdentityDocumentSignature

type totalResources

list

param totalResources
  • (dict) --

    Describes the resources available for a container instance.

    • name (string) --

      The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

    • type (string) --

      The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

    • doubleValue (float) --

      When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

    • longValue (integer) --

      When the longValue type is set, the value of the resource must be an extended precision floating-point type.

    • integerValue (integer) --

      When the integerValue type is set, the value of the resource must be an integer.

    • stringSetValue (list) --

      When the stringSetValue type is set, the value of the resource must be a string type.

      • (string) --

type versionInfo

dict

param versionInfo
  • agentVersion (string) --

  • agentHash (string) --

  • dockerVersion (string) --

rtype

dict

returns

Response Syntax

{
    'containerInstance': {
        'containerInstanceArn': 'string',
        'ec2InstanceId': 'string',
        'remainingResources': [
            {
                'name': 'string',
                'type': 'string',
                'doubleValue': 123.0,
                'longValue': 123,
                'integerValue': 123,
                'stringSetValue': [
                    'string',
                ]
            },
        ],
        'registeredResources': [
            {
                'name': 'string',
                'type': 'string',
                'doubleValue': 123.0,
                'longValue': 123,
                'integerValue': 123,
                'stringSetValue': [
                    'string',
                ]
            },
        ],
        'status': 'string',
        'agentConnected': True|False,
        'runningTasksCount': 123,
        'pendingTasksCount': 123
    }
}

Response Structure

  • (dict) --

    • containerInstance (dict) --

      An Amazon EC2 instance that is running the Amazon ECS agent and has been registered with a cluster.

      • containerInstanceArn (string) --

        The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_UUID .

      • ec2InstanceId (string) --

        The Amazon EC2 instance ID of the container instance.

      • remainingResources (list) --

        The remaining resources of the container instance that are available for new tasks.

        • (dict) --

          Describes the resources available for a container instance.

          • name (string) --

            The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

          • type (string) --

            The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

          • doubleValue (float) --

            When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

          • longValue (integer) --

            When the longValue type is set, the value of the resource must be an extended precision floating-point type.

          • integerValue (integer) --

            When the integerValue type is set, the value of the resource must be an integer.

          • stringSetValue (list) --

            When the stringSetValue type is set, the value of the resource must be a string type.

            • (string) --

      • registeredResources (list) --

        The registered resources on the container instance that are in use by current tasks.

        • (dict) --

          Describes the resources available for a container instance.

          • name (string) --

            The name of the resource, such as CPU , MEMORY , PORTS , or a user-defined resource.

          • type (string) --

            The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .

          • doubleValue (float) --

            When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

          • longValue (integer) --

            When the longValue type is set, the value of the resource must be an extended precision floating-point type.

          • integerValue (integer) --

            When the integerValue type is set, the value of the resource must be an integer.

          • stringSetValue (list) --

            When the stringSetValue type is set, the value of the resource must be a string type.

            • (string) --

      • status (string) --

        The status of the container instance. The valid values are ACTIVE or INACTIVE . ACTIVE indicates that the container instance can accept tasks.

      • agentConnected (boolean) --

        This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false , and instances without a connected agent cannot accept placement request.

      • runningTasksCount (integer) --

        The number of tasks on the container instance that are in the RUNNING status.

      • pendingTasksCount (integer) --

        The number of tasks on the container instance that are in the PENDING status.

RunTask (updated) Link ¶
Changes (request, response)
Request
{'startedBy': 'string'}
Response
{'tasks': {'startedBy': 'string'}}

Start a task using random placement and the default Amazon ECS scheduler. If you want to use your own scheduler or place a task on a specific container instance, use StartTask instead.

Warning

The count parameter is limited to 10 tasks per call.

Request Syntax

client.run_task(
    cluster='string',
    taskDefinition='string',
    overrides={
        'containerOverrides': [
            {
                'name': 'string',
                'command': [
                    'string',
                ]
            },
        ]
    },
    count=123,
    startedBy='string'
)
type cluster

string

param cluster

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

type taskDefinition

string

param taskDefinition

[REQUIRED]

The family and revision ( family:revision ) or full Amazon Resource Name (ARN) of the task definition that you want to run.

type overrides

dict

param overrides

A list of container overrides in JSON format that specify the name of a container in the specified task definition and the command it should run instead of its default. A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure.

  • containerOverrides (list) --

    One or more container overrides sent to a task.

    • (dict) --

      The name of a container in a task definition and the command it should run instead of its default.

      • name (string) --

        The name of the container that receives the override.

      • command (list) --

        The command to send to the container that overrides the default command from the Docker image or the task definition.

        • (string) --

type count

integer

param count

The number of instantiations of the specified task that you would like to place on your cluster.

Warning

The count parameter is limited to 10 tasks per call.

type startedBy

string

param startedBy

rtype

dict

returns

Response Syntax

{
    'tasks': [
        {
            'taskArn': 'string',
            'clusterArn': 'string',
            'taskDefinitionArn': 'string',
            'containerInstanceArn': 'string',
            'overrides': {
                'containerOverrides': [
                    {
                        'name': 'string',
                        'command': [
                            'string',
                        ]
                    },
                ]
            },
            'lastStatus': 'string',
            'desiredStatus': 'string',
            'containers': [
                {
                    'containerArn': 'string',
                    'taskArn': 'string',
                    'name': 'string',
                    'lastStatus': 'string',
                    'exitCode': 123,
                    'reason': 'string',
                    'networkBindings': [
                        {
                            'bindIP': 'string',
                            'containerPort': 123,
                            'hostPort': 123
                        },
                    ]
                },
            ],
            'startedBy': 'string'
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • tasks (list) --

      A full description of the tasks that were run. Each task that was successfully placed on your cluster will be described here.

      • (dict) --

        • taskArn (string) --

          The Amazon Resource Name (ARN) of the task.

        • clusterArn (string) --

          The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

        • taskDefinitionArn (string) --

          The Amazon Resource Name (ARN) of the of the task definition that creates the task.

        • containerInstanceArn (string) --

          The Amazon Resource Name (ARN) of the container instances that host the task.

        • overrides (dict) --

          One or more container overrides.

          • containerOverrides (list) --

            One or more container overrides sent to a task.

            • (dict) --

              The name of a container in a task definition and the command it should run instead of its default.

              • name (string) --

                The name of the container that receives the override.

              • command (list) --

                The command to send to the container that overrides the default command from the Docker image or the task definition.

                • (string) --

        • lastStatus (string) --

          The last known status of the task.

        • desiredStatus (string) --

          The desired status of the task.

        • containers (list) --

          The containers associated with the task.

          • (dict) --

            • containerArn (string) --

              The Amazon Resource Name (ARN) of the container.

            • taskArn (string) --

              The Amazon Resource Name (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 detail about a running or stopped container.

            • networkBindings (list) --

              • (dict) --

                • 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 be used with the network binding.

                • hostPort (integer) --

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

        • startedBy (string) --

    • failures (list) --

      Any failed tasks from your RunTask action are listed here.

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

StartTask (updated) Link ¶
Changes (request, response)
Request
{'startedBy': 'string'}
Response
{'tasks': {'startedBy': 'string'}}

Starts a new task from the specified task definition on the specified container instance or instances. If you want to use the default Amazon ECS scheduler to place your task, use RunTask instead.

Warning

The list of container instances to start tasks on is limited to 10.

Request Syntax

client.start_task(
    cluster='string',
    taskDefinition='string',
    overrides={
        'containerOverrides': [
            {
                'name': 'string',
                'command': [
                    'string',
                ]
            },
        ]
    },
    containerInstances=[
        'string',
    ],
    startedBy='string'
)
type cluster

string

param cluster

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

type taskDefinition

string

param taskDefinition

[REQUIRED]

The family and revision ( family:revision ) or full Amazon Resource Name (ARN) of the task definition that you want to start.

type overrides

dict

param overrides

A list of container overrides in JSON format that specify the name of a container in the specified task definition and the command it should run instead of its default. A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure.

  • containerOverrides (list) --

    One or more container overrides sent to a task.

    • (dict) --

      The name of a container in a task definition and the command it should run instead of its default.

      • name (string) --

        The name of the container that receives the override.

      • command (list) --

        The command to send to the container that overrides the default command from the Docker image or the task definition.

        • (string) --

type containerInstances

list

param containerInstances

[REQUIRED]

The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task.

Warning

The list of container instances to start tasks on is limited to 10.

  • (string) --

type startedBy

string

param startedBy

rtype

dict

returns

Response Syntax

{
    'tasks': [
        {
            'taskArn': 'string',
            'clusterArn': 'string',
            'taskDefinitionArn': 'string',
            'containerInstanceArn': 'string',
            'overrides': {
                'containerOverrides': [
                    {
                        'name': 'string',
                        'command': [
                            'string',
                        ]
                    },
                ]
            },
            'lastStatus': 'string',
            'desiredStatus': 'string',
            'containers': [
                {
                    'containerArn': 'string',
                    'taskArn': 'string',
                    'name': 'string',
                    'lastStatus': 'string',
                    'exitCode': 123,
                    'reason': 'string',
                    'networkBindings': [
                        {
                            'bindIP': 'string',
                            'containerPort': 123,
                            'hostPort': 123
                        },
                    ]
                },
            ],
            'startedBy': 'string'
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • tasks (list) --

      A full description of the tasks that were started. Each task that was successfully placed on your container instances will be described here.

      • (dict) --

        • taskArn (string) --

          The Amazon Resource Name (ARN) of the task.

        • clusterArn (string) --

          The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

        • taskDefinitionArn (string) --

          The Amazon Resource Name (ARN) of the of the task definition that creates the task.

        • containerInstanceArn (string) --

          The Amazon Resource Name (ARN) of the container instances that host the task.

        • overrides (dict) --

          One or more container overrides.

          • containerOverrides (list) --

            One or more container overrides sent to a task.

            • (dict) --

              The name of a container in a task definition and the command it should run instead of its default.

              • name (string) --

                The name of the container that receives the override.

              • command (list) --

                The command to send to the container that overrides the default command from the Docker image or the task definition.

                • (string) --

        • lastStatus (string) --

          The last known status of the task.

        • desiredStatus (string) --

          The desired status of the task.

        • containers (list) --

          The containers associated with the task.

          • (dict) --

            • containerArn (string) --

              The Amazon Resource Name (ARN) of the container.

            • taskArn (string) --

              The Amazon Resource Name (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 detail about a running or stopped container.

            • networkBindings (list) --

              • (dict) --

                • 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 be used with the network binding.

                • hostPort (integer) --

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

        • startedBy (string) --

    • failures (list) --

      Any failed tasks from your StartTask action are listed here.

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

StopTask (updated) Link ¶
Changes (response)
{'task': {'startedBy': 'string'}}

Stops a running task.

Request Syntax

client.stop_task(
    cluster='string',
    task='string'
)
type cluster

string

param cluster

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

type task

string

param task

[REQUIRED]

The task UUIDs or full Amazon Resource Name (ARN) entry of the task you would like to stop.

rtype

dict

returns

Response Syntax

{
    'task': {
        'taskArn': 'string',
        'clusterArn': 'string',
        'taskDefinitionArn': 'string',
        'containerInstanceArn': 'string',
        'overrides': {
            'containerOverrides': [
                {
                    'name': 'string',
                    'command': [
                        'string',
                    ]
                },
            ]
        },
        'lastStatus': 'string',
        'desiredStatus': 'string',
        'containers': [
            {
                'containerArn': 'string',
                'taskArn': 'string',
                'name': 'string',
                'lastStatus': 'string',
                'exitCode': 123,
                'reason': 'string',
                'networkBindings': [
                    {
                        'bindIP': 'string',
                        'containerPort': 123,
                        'hostPort': 123
                    },
                ]
            },
        ],
        'startedBy': 'string'
    }
}

Response Structure

  • (dict) --

    • task (dict) --

      • taskArn (string) --

        The Amazon Resource Name (ARN) of the task.

      • clusterArn (string) --

        The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

      • taskDefinitionArn (string) --

        The Amazon Resource Name (ARN) of the of the task definition that creates the task.

      • containerInstanceArn (string) --

        The Amazon Resource Name (ARN) of the container instances that host the task.

      • overrides (dict) --

        One or more container overrides.

        • containerOverrides (list) --

          One or more container overrides sent to a task.

          • (dict) --

            The name of a container in a task definition and the command it should run instead of its default.

            • name (string) --

              The name of the container that receives the override.

            • command (list) --

              The command to send to the container that overrides the default command from the Docker image or the task definition.

              • (string) --

      • lastStatus (string) --

        The last known status of the task.

      • desiredStatus (string) --

        The desired status of the task.

      • containers (list) --

        The containers associated with the task.

        • (dict) --

          • containerArn (string) --

            The Amazon Resource Name (ARN) of the container.

          • taskArn (string) --

            The Amazon Resource Name (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 detail about a running or stopped container.

          • networkBindings (list) --

            • (dict) --

              • 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 be used with the network binding.

              • hostPort (integer) --

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

      • startedBy (string) --