Amazon EC2 Container Service

2015/06/11 - Amazon EC2 Container Service - 1 new 16 updated api methods

UpdateContainerAgent (new) Link ¶

Updates the Amazon ECS container agent on a specified container instance.

Request Syntax

client.update_container_agent(
    cluster='string',
    containerInstance='string'
)
type cluster

string

param cluster

The short name or full Amazon Resource Name (ARN) of the cluster that your container instance is running on. 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) entries for the container instance on which you would like to update the Amazon ECS container agent.

rtype

dict

returns

Response Syntax

{
    'containerInstance': {
        'containerInstanceArn': 'string',
        'ec2InstanceId': 'string',
        'versionInfo': {
            'agentVersion': 'string',
            'agentHash': 'string',
            'dockerVersion': '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,
        'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
    }
}

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.

      • versionInfo (dict) --

        The version information for the Amazon ECS container agent and Docker daemon running on the container instance.

        • agentVersion (string) --

          The version number of the Amazon ECS container agent.

        • agentHash (string) --

          The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.

        • dockerVersion (string) --

          The Docker version running on 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.

      • agentUpdateStatus (string) --

        The status of the most recent agent update. If an update has never been requested, this value is NULL .

CreateCluster (updated) Link ¶
Changes (response)
{'cluster': {'activeServicesCount': '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,
        'activeServicesCount': 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.

      • activeServicesCount (integer) --

        The number of services that are running on the cluster in an ACTIVE state. You can view these services with ListServices.

DeleteCluster (updated) Link ¶
Changes (response)
{'cluster': {'activeServicesCount': '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,
        'activeServicesCount': 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.

      • activeServicesCount (integer) --

        The number of services that are running on the cluster in an ACTIVE state. You can view these services with ListServices.

DeregisterContainerInstance (updated) Link ¶
Changes (response)
{'containerInstance': {'agentUpdateStatus': 'PENDING | STAGING | STAGED | '
                                            'UPDATING | UPDATED | FAILED',
                       'versionInfo': {'agentHash': 'string',
                                       'agentVersion': 'string',
                                       'dockerVersion': 'string'}}}

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',
        'versionInfo': {
            'agentVersion': 'string',
            'agentHash': 'string',
            'dockerVersion': '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,
        'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
    }
}

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.

      • versionInfo (dict) --

        The version information for the Amazon ECS container agent and Docker daemon running on the container instance.

        • agentVersion (string) --

          The version number of the Amazon ECS container agent.

        • agentHash (string) --

          The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.

        • dockerVersion (string) --

          The Docker version running on 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.

      • agentUpdateStatus (string) --

        The status of the most recent agent update. If an update has never been requested, this value is NULL .

DeregisterTaskDefinition (updated) Link ¶
Changes (response)
{'taskDefinition': {'containerDefinitions': {'portMappings': {'protocol': 'tcp '
                                                                          '| '
                                                                          'udp'}}}}

NOT YET IMPLEMENTED.

Deregisters the specified task definition. You will no longer be able to run tasks from this definition after deregistration.

Request Syntax

client.deregister_task_definition(
    taskDefinition='string'
)
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 deregister.

rtype

dict

returns

Response Syntax

{
    'taskDefinition': {
        'taskDefinitionArn': 'string',
        'containerDefinitions': [
            {
                'name': 'string',
                'image': 'string',
                'cpu': 123,
                'memory': 123,
                'links': [
                    'string',
                ],
                'portMappings': [
                    {
                        'containerPort': 123,
                        'hostPort': 123,
                        'protocol': 'tcp'|'udp'
                    },
                ],
                'essential': True|False,
                'entryPoint': [
                    'string',
                ],
                'command': [
                    'string',
                ],
                'environment': [
                    {
                        'name': 'string',
                        'value': 'string'
                    },
                ],
                'mountPoints': [
                    {
                        'sourceVolume': 'string',
                        'containerPath': 'string',
                        'readOnly': True|False
                    },
                ],
                'volumesFrom': [
                    {
                        'sourceContainer': 'string',
                        'readOnly': True|False
                    },
                ]
            },
        ],
        'family': 'string',
        'revision': 123,
        'volumes': [
            {
                'name': 'string',
                'host': {
                    'sourcePath': 'string'
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • taskDefinition (dict) --

      The full description of the deregistered task.

      • taskDefinitionArn (string) --

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

      • containerDefinitions (list) --

        A list of container definitions in JSON format that describe the different containers that make up your task. For more information on container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

        • (dict) --

          Container definitions are used in task definitions to describe the different containers that are launched as part of a task.

          • name (string) --

            The name of a container. If you are linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers.

          • image (string) --

            The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with repository-url/image:tag .

          • cpu (integer) --

            The number of cpu units reserved for the container. A container instance has 1,024 cpu units for every CPU core. This parameter specifies the minimum amount of CPU to reserve for a container, and containers share unallocated CPU units with other containers on the instance with the same ratio as their allocated amount.

            For example, if you run a single-container task on a single-core instance type with 512 CPU units specified for that container, and that is the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task would be guaranteed a minimum of 512 CPU units when needed, and each container could float to higher CPU usage if the other container was not using it, but if both tasks were 100% active all of the time, they would be limited to 512 CPU units.

            If this parameter is omitted, 0 CPU units are reserved for the container, and it will only receive CPU time when other containers are not using it.

          • memory (integer) --

            The number of MiB of memory reserved for the container. If your container attempts to exceed the memory allocated here, the container is killed.

          • links (list) --

            The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter. The name:internalName construct is analogous to name:alias in Docker links. For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/.

            Warning

            Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.

            • (string) --

          • portMappings (list) --

            The list of port mappings for the container.

            • (dict) --

              Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part of the container definition.

              • containerPort (integer) --

                The port number on the container that is bound to the user-specified or automatically assigned host port. If you specify a container port and not a host port, your container will automatically receive a host port in the 49153 to 65535 port range.

              • hostPort (integer) --

                The port number on the container instance to reserve for your container. You can specify a non-reserved host port for your container port mapping, or you can omit the hostPort (or set it to 0 ) while specifying a containerPort and your container will automatically receive a port in the 49153 to 65535 port range. You should not attempt to specify a host port in the 49153 to 65535 port range, since these are reserved for automatic assignment.

                The default reserved ports are 22 for SSH, the Docker ports 2375 and 2376, and the Amazon ECS Container Agent port 51678. Any host port that was previously specified in a running task is also reserved while the task is running (once a task stops, the host port is released).The current reserved ports are displayed in the remainingResources of DescribeContainerInstances output, and a container instance may have up to 50 reserved ports at a time, including the default reserved ports (automatically assigned ports do not count toward this limit).

              • protocol (string) --

                The protocol used for the port mapping. The default is tcp .

          • essential (boolean) --

            If the essential parameter of a container is marked as true , the failure of that container will stop the task. If the essential parameter of a container is marked as false , then its failure will not affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.

            Note

            All tasks must have at least one essential container.

          • entryPoint (list) --

            Warning

            Early versions of the Amazon ECS container agent do not properly handle entryPoint parameters. If you have problems using entryPoint , update your container agent or enter your commands and arguments as command array items instead.

            The ENTRYPOINT that is passed to the container. For more information on the Docker ENTRYPOINT parameter, see https://docs.docker.com/reference/builder/#entrypoint.

            • (string) --

          • command (list) --

            The CMD that is passed to the container. For more information on the Docker CMD parameter, see https://docs.docker.com/reference/builder/#cmd.

            • (string) --

          • environment (list) --

            The environment variables to pass to a container.

            • (dict) --

              • name (string) --

                The name of the key value pair.

              • value (string) --

                The value of the key value pair.

          • mountPoints (list) --

            The mount points for data volumes in your container.

            • (dict) --

              • sourceVolume (string) --

                The name of the volume to mount.

              • containerPath (string) --

                The path on the container to mount the host volume at.

              • readOnly (boolean) --

                If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

          • volumesFrom (list) --

            Data volumes to mount from another container.

            • (dict) --

              • sourceContainer (string) --

                The name of the container to mount volumes from.

              • readOnly (boolean) --

                If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

      • family (string) --

        The family of your task definition. You can think of the family as the name of your task definition.

      • revision (integer) --

        The revision of the task in a particular family. You can think of the revision as a version number of a task definition in a family. When you register a task definition for the first time, the revision is 1 , and each time you register a task definition in the same family, the revision value increases by one.

      • volumes (list) --

        The list of volumes in a task. For more information on volume definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

        • (dict) --

          • name (string) --

            The name of the volume. This name is referenced in the sourceVolume parameter of container definition mountPoints .

          • host (dict) --

            The path on the host container instance that is presented to the containers which access the volume. If this parameter is empty, then the Docker daemon assigns a host path for you.

            • sourcePath (string) --

              The path on the host container instance that is presented to the container. If this parameter is empty, then the Docker daemon has assigned a host path for you.

DescribeClusters (updated) Link ¶
Changes (response)
{'clusters': {'activeServicesCount': '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,
            'activeServicesCount': 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.

        • 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.

        • activeServicesCount (integer) --

          The number of services that are running on the cluster in an ACTIVE state. You can view these services with ListServices.

    • 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': {'agentUpdateStatus': 'PENDING | STAGING | STAGED | '
                                             'UPDATING | UPDATED | FAILED',
                        'versionInfo': {'agentHash': 'string',
                                        'agentVersion': 'string',
                                        'dockerVersion': 'string'}}}

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',
            'versionInfo': {
                'agentVersion': 'string',
                'agentHash': 'string',
                'dockerVersion': '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,
            'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
        },
    ],
    '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.

        • versionInfo (dict) --

          The version information for the Amazon ECS container agent and Docker daemon running on the container instance.

          • agentVersion (string) --

            The version number of the Amazon ECS container agent.

          • agentHash (string) --

            The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.

          • dockerVersion (string) --

            The Docker version running on 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.

        • agentUpdateStatus (string) --

          The status of the most recent agent update. If an update has never been requested, this value is NULL .

    • failures (list) --

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

DescribeTaskDefinition (updated) Link ¶
Changes (response)
{'taskDefinition': {'containerDefinitions': {'portMappings': {'protocol': 'tcp '
                                                                          '| '
                                                                          'udp'}}}}

Describes a task definition. You can specify a family and revision to find information on a specific task definition, or you can simply specify the family to find the latest revision in that family.

Request Syntax

client.describe_task_definition(
    taskDefinition='string'
)
type taskDefinition

string

param taskDefinition

[REQUIRED]

The family for the latest revision, family and revision ( family:revision ) for a specific revision in the family, or full Amazon Resource Name (ARN) of the task definition that you want to describe.

rtype

dict

returns

Response Syntax

{
    'taskDefinition': {
        'taskDefinitionArn': 'string',
        'containerDefinitions': [
            {
                'name': 'string',
                'image': 'string',
                'cpu': 123,
                'memory': 123,
                'links': [
                    'string',
                ],
                'portMappings': [
                    {
                        'containerPort': 123,
                        'hostPort': 123,
                        'protocol': 'tcp'|'udp'
                    },
                ],
                'essential': True|False,
                'entryPoint': [
                    'string',
                ],
                'command': [
                    'string',
                ],
                'environment': [
                    {
                        'name': 'string',
                        'value': 'string'
                    },
                ],
                'mountPoints': [
                    {
                        'sourceVolume': 'string',
                        'containerPath': 'string',
                        'readOnly': True|False
                    },
                ],
                'volumesFrom': [
                    {
                        'sourceContainer': 'string',
                        'readOnly': True|False
                    },
                ]
            },
        ],
        'family': 'string',
        'revision': 123,
        'volumes': [
            {
                'name': 'string',
                'host': {
                    'sourcePath': 'string'
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • taskDefinition (dict) --

      The full task definition description.

      • taskDefinitionArn (string) --

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

      • containerDefinitions (list) --

        A list of container definitions in JSON format that describe the different containers that make up your task. For more information on container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

        • (dict) --

          Container definitions are used in task definitions to describe the different containers that are launched as part of a task.

          • name (string) --

            The name of a container. If you are linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers.

          • image (string) --

            The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with repository-url/image:tag .

          • cpu (integer) --

            The number of cpu units reserved for the container. A container instance has 1,024 cpu units for every CPU core. This parameter specifies the minimum amount of CPU to reserve for a container, and containers share unallocated CPU units with other containers on the instance with the same ratio as their allocated amount.

            For example, if you run a single-container task on a single-core instance type with 512 CPU units specified for that container, and that is the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task would be guaranteed a minimum of 512 CPU units when needed, and each container could float to higher CPU usage if the other container was not using it, but if both tasks were 100% active all of the time, they would be limited to 512 CPU units.

            If this parameter is omitted, 0 CPU units are reserved for the container, and it will only receive CPU time when other containers are not using it.

          • memory (integer) --

            The number of MiB of memory reserved for the container. If your container attempts to exceed the memory allocated here, the container is killed.

          • links (list) --

            The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter. The name:internalName construct is analogous to name:alias in Docker links. For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/.

            Warning

            Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.

            • (string) --

          • portMappings (list) --

            The list of port mappings for the container.

            • (dict) --

              Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part of the container definition.

              • containerPort (integer) --

                The port number on the container that is bound to the user-specified or automatically assigned host port. If you specify a container port and not a host port, your container will automatically receive a host port in the 49153 to 65535 port range.

              • hostPort (integer) --

                The port number on the container instance to reserve for your container. You can specify a non-reserved host port for your container port mapping, or you can omit the hostPort (or set it to 0 ) while specifying a containerPort and your container will automatically receive a port in the 49153 to 65535 port range. You should not attempt to specify a host port in the 49153 to 65535 port range, since these are reserved for automatic assignment.

                The default reserved ports are 22 for SSH, the Docker ports 2375 and 2376, and the Amazon ECS Container Agent port 51678. Any host port that was previously specified in a running task is also reserved while the task is running (once a task stops, the host port is released).The current reserved ports are displayed in the remainingResources of DescribeContainerInstances output, and a container instance may have up to 50 reserved ports at a time, including the default reserved ports (automatically assigned ports do not count toward this limit).

              • protocol (string) --

                The protocol used for the port mapping. The default is tcp .

          • essential (boolean) --

            If the essential parameter of a container is marked as true , the failure of that container will stop the task. If the essential parameter of a container is marked as false , then its failure will not affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.

            Note

            All tasks must have at least one essential container.

          • entryPoint (list) --

            Warning

            Early versions of the Amazon ECS container agent do not properly handle entryPoint parameters. If you have problems using entryPoint , update your container agent or enter your commands and arguments as command array items instead.

            The ENTRYPOINT that is passed to the container. For more information on the Docker ENTRYPOINT parameter, see https://docs.docker.com/reference/builder/#entrypoint.

            • (string) --

          • command (list) --

            The CMD that is passed to the container. For more information on the Docker CMD parameter, see https://docs.docker.com/reference/builder/#cmd.

            • (string) --

          • environment (list) --

            The environment variables to pass to a container.

            • (dict) --

              • name (string) --

                The name of the key value pair.

              • value (string) --

                The value of the key value pair.

          • mountPoints (list) --

            The mount points for data volumes in your container.

            • (dict) --

              • sourceVolume (string) --

                The name of the volume to mount.

              • containerPath (string) --

                The path on the container to mount the host volume at.

              • readOnly (boolean) --

                If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

          • volumesFrom (list) --

            Data volumes to mount from another container.

            • (dict) --

              • sourceContainer (string) --

                The name of the container to mount volumes from.

              • readOnly (boolean) --

                If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

      • family (string) --

        The family of your task definition. You can think of the family as the name of your task definition.

      • revision (integer) --

        The revision of the task in a particular family. You can think of the revision as a version number of a task definition in a family. When you register a task definition for the first time, the revision is 1 , and each time you register a task definition in the same family, the revision value increases by one.

      • volumes (list) --

        The list of volumes in a task. For more information on volume definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

        • (dict) --

          • name (string) --

            The name of the volume. This name is referenced in the sourceVolume parameter of container definition mountPoints .

          • host (dict) --

            The path on the host container instance that is presented to the containers which access the volume. If this parameter is empty, then the Docker daemon assigns a host path for you.

            • sourcePath (string) --

              The path on the host container instance that is presented to the container. If this parameter is empty, then the Docker daemon has assigned a host path for you.

DescribeTasks (updated) Link ¶
Changes (response)
{'tasks': {'containers': {'networkBindings': {'protocol': 'tcp | udp'}}}}

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,
                            'protocol': 'tcp'|'udp'
                        },
                    ]
                },
            ],
            '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.

                • protocol (string) --

                  The protocol used for the network binding.

        • 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.

    • failures (list) --

      • (dict) --

        • arn (string) --

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

        • reason (string) --

          The reason for the failure.

DiscoverPollEndpoint (updated) Link ¶
Changes (response)
{'telemetryEndpoint': 'string'}

Note

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

Returns an endpoint for the Amazon EC2 Container Service agent to poll for updates.

Request Syntax

client.discover_poll_endpoint(
    containerInstance='string',
    cluster='string'
)
type containerInstance

string

param containerInstance

The container instance UUID or full 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 .

type cluster

string

param cluster

The cluster that the container instance belongs to.

rtype

dict

returns

Response Syntax

{
    'endpoint': 'string',
    'telemetryEndpoint': 'string'
}

Response Structure

  • (dict) --

    • endpoint (string) --

      The endpoint for the Amazon ECS agent to poll.

    • telemetryEndpoint (string) --

      The telemetry endpoint for the Amazon ECS agent.

ListTasks (updated) Link ¶
Changes (request)
{'desiredStatus': 'RUNNING | PENDING | STOPPED'}

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

Request Syntax

client.list_tasks(
    cluster='string',
    containerInstance='string',
    family='string',
    nextToken='string',
    maxResults=123,
    startedBy='string',
    serviceName='string',
    desiredStatus='RUNNING'|'PENDING'|'STOPPED'
)
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

The startedBy value that you want to filter the task results with. Specifying a startedBy value will limit the results to tasks that were started with that value.

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.

type desiredStatus

string

param desiredStatus

The task status that you want to filter the ListTasks results with. Specifying a desiredStatus of STOPPED will limit the results to tasks that are in the STOPPED status, which can be useful for debugging tasks that are not starting properly or have died or finished. The default status filter is RUNNING .

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 (response)
{'containerInstance': {'agentUpdateStatus': 'PENDING | STAGING | STAGED | '
                                            'UPDATING | UPDATED | FAILED',
                       'versionInfo': {'agentHash': 'string',
                                       'agentVersion': 'string',
                                       'dockerVersion': 'string'}}}

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

The instance identity document for the Amazon EC2 instance to register. This document can be found by running the following command from the instance: curl http://169.254.169.254/latest/dynamic/instance-identity/document/

type instanceIdentityDocumentSignature

string

param instanceIdentityDocumentSignature

The instance identity document signature for the Amazon EC2 instance to register. This signature can be found by running the following command from the instance: curl http://169.254.169.254/latest/dynamic/instance-identity/signature/

type totalResources

list

param totalResources

The resources available on the instance.

  • (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

The version information for the Amazon ECS container agent and Docker daemon running on the container instance.

  • agentVersion (string) --

    The version number of the Amazon ECS container agent.

  • agentHash (string) --

    The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.

  • dockerVersion (string) --

    The Docker version running on the container instance.

rtype

dict

returns

Response Syntax

{
    'containerInstance': {
        'containerInstanceArn': 'string',
        'ec2InstanceId': 'string',
        'versionInfo': {
            'agentVersion': 'string',
            'agentHash': 'string',
            'dockerVersion': '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,
        'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
    }
}

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.

      • versionInfo (dict) --

        The version information for the Amazon ECS container agent and Docker daemon running on the container instance.

        • agentVersion (string) --

          The version number of the Amazon ECS container agent.

        • agentHash (string) --

          The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.

        • dockerVersion (string) --

          The Docker version running on 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.

      • agentUpdateStatus (string) --

        The status of the most recent agent update. If an update has never been requested, this value is NULL .

RegisterTaskDefinition (updated) Link ¶
Changes (request, response)
Request
{'containerDefinitions': {'portMappings': {'protocol': 'tcp | udp'}}}
Response
{'taskDefinition': {'containerDefinitions': {'portMappings': {'protocol': 'tcp '
                                                                          '| '
                                                                          'udp'}}}}

Registers a new task definition from the supplied family and containerDefinitions . Optionally, you can add data volumes to your containers with the volumes parameter. For more information on task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

Request Syntax

client.register_task_definition(
    family='string',
    containerDefinitions=[
        {
            'name': 'string',
            'image': 'string',
            'cpu': 123,
            'memory': 123,
            'links': [
                'string',
            ],
            'portMappings': [
                {
                    'containerPort': 123,
                    'hostPort': 123,
                    'protocol': 'tcp'|'udp'
                },
            ],
            'essential': True|False,
            'entryPoint': [
                'string',
            ],
            'command': [
                'string',
            ],
            'environment': [
                {
                    'name': 'string',
                    'value': 'string'
                },
            ],
            'mountPoints': [
                {
                    'sourceVolume': 'string',
                    'containerPath': 'string',
                    'readOnly': True|False
                },
            ],
            'volumesFrom': [
                {
                    'sourceContainer': 'string',
                    'readOnly': True|False
                },
            ]
        },
    ],
    volumes=[
        {
            'name': 'string',
            'host': {
                'sourcePath': 'string'
            }
        },
    ]
)
type family

string

param family

[REQUIRED]

You must specify a family for a task definition, which allows you to track multiple versions of the same task definition. You can think of the family as a name for your task definition. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

type containerDefinitions

list

param containerDefinitions

[REQUIRED]

A list of container definitions in JSON format that describe the different containers that make up your task.

  • (dict) --

    Container definitions are used in task definitions to describe the different containers that are launched as part of a task.

    • name (string) --

      The name of a container. If you are linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers.

    • image (string) --

      The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with repository-url/image:tag .

    • cpu (integer) --

      The number of cpu units reserved for the container. A container instance has 1,024 cpu units for every CPU core. This parameter specifies the minimum amount of CPU to reserve for a container, and containers share unallocated CPU units with other containers on the instance with the same ratio as their allocated amount.

      For example, if you run a single-container task on a single-core instance type with 512 CPU units specified for that container, and that is the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task would be guaranteed a minimum of 512 CPU units when needed, and each container could float to higher CPU usage if the other container was not using it, but if both tasks were 100% active all of the time, they would be limited to 512 CPU units.

      If this parameter is omitted, 0 CPU units are reserved for the container, and it will only receive CPU time when other containers are not using it.

    • memory (integer) --

      The number of MiB of memory reserved for the container. If your container attempts to exceed the memory allocated here, the container is killed.

    • links (list) --

      The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter. The name:internalName construct is analogous to name:alias in Docker links. For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/.

      Warning

      Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.

      • (string) --

    • portMappings (list) --

      The list of port mappings for the container.

      • (dict) --

        Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part of the container definition.

        • containerPort (integer) --

          The port number on the container that is bound to the user-specified or automatically assigned host port. If you specify a container port and not a host port, your container will automatically receive a host port in the 49153 to 65535 port range.

        • hostPort (integer) --

          The port number on the container instance to reserve for your container. You can specify a non-reserved host port for your container port mapping, or you can omit the hostPort (or set it to 0 ) while specifying a containerPort and your container will automatically receive a port in the 49153 to 65535 port range. You should not attempt to specify a host port in the 49153 to 65535 port range, since these are reserved for automatic assignment.

          The default reserved ports are 22 for SSH, the Docker ports 2375 and 2376, and the Amazon ECS Container Agent port 51678. Any host port that was previously specified in a running task is also reserved while the task is running (once a task stops, the host port is released).The current reserved ports are displayed in the remainingResources of DescribeContainerInstances output, and a container instance may have up to 50 reserved ports at a time, including the default reserved ports (automatically assigned ports do not count toward this limit).

        • protocol (string) --

          The protocol used for the port mapping. The default is tcp .

    • essential (boolean) --

      If the essential parameter of a container is marked as true , the failure of that container will stop the task. If the essential parameter of a container is marked as false , then its failure will not affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.

      Note

      All tasks must have at least one essential container.

    • entryPoint (list) --

      Warning

      Early versions of the Amazon ECS container agent do not properly handle entryPoint parameters. If you have problems using entryPoint , update your container agent or enter your commands and arguments as command array items instead.

      The ENTRYPOINT that is passed to the container. For more information on the Docker ENTRYPOINT parameter, see https://docs.docker.com/reference/builder/#entrypoint.

      • (string) --

    • command (list) --

      The CMD that is passed to the container. For more information on the Docker CMD parameter, see https://docs.docker.com/reference/builder/#cmd.

      • (string) --

    • environment (list) --

      The environment variables to pass to a container.

      • (dict) --

        • name (string) --

          The name of the key value pair.

        • value (string) --

          The value of the key value pair.

    • mountPoints (list) --

      The mount points for data volumes in your container.

      • (dict) --

        • sourceVolume (string) --

          The name of the volume to mount.

        • containerPath (string) --

          The path on the container to mount the host volume at.

        • readOnly (boolean) --

          If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

    • volumesFrom (list) --

      Data volumes to mount from another container.

      • (dict) --

        • sourceContainer (string) --

          The name of the container to mount volumes from.

        • readOnly (boolean) --

          If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

type volumes

list

param volumes

A list of volume definitions in JSON format that containers in your task may use.

  • (dict) --

    • name (string) --

      The name of the volume. This name is referenced in the sourceVolume parameter of container definition mountPoints .

    • host (dict) --

      The path on the host container instance that is presented to the containers which access the volume. If this parameter is empty, then the Docker daemon assigns a host path for you.

      • sourcePath (string) --

        The path on the host container instance that is presented to the container. If this parameter is empty, then the Docker daemon has assigned a host path for you.

rtype

dict

returns

Response Syntax

{
    'taskDefinition': {
        'taskDefinitionArn': 'string',
        'containerDefinitions': [
            {
                'name': 'string',
                'image': 'string',
                'cpu': 123,
                'memory': 123,
                'links': [
                    'string',
                ],
                'portMappings': [
                    {
                        'containerPort': 123,
                        'hostPort': 123,
                        'protocol': 'tcp'|'udp'
                    },
                ],
                'essential': True|False,
                'entryPoint': [
                    'string',
                ],
                'command': [
                    'string',
                ],
                'environment': [
                    {
                        'name': 'string',
                        'value': 'string'
                    },
                ],
                'mountPoints': [
                    {
                        'sourceVolume': 'string',
                        'containerPath': 'string',
                        'readOnly': True|False
                    },
                ],
                'volumesFrom': [
                    {
                        'sourceContainer': 'string',
                        'readOnly': True|False
                    },
                ]
            },
        ],
        'family': 'string',
        'revision': 123,
        'volumes': [
            {
                'name': 'string',
                'host': {
                    'sourcePath': 'string'
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • taskDefinition (dict) --

      • taskDefinitionArn (string) --

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

      • containerDefinitions (list) --

        A list of container definitions in JSON format that describe the different containers that make up your task. For more information on container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

        • (dict) --

          Container definitions are used in task definitions to describe the different containers that are launched as part of a task.

          • name (string) --

            The name of a container. If you are linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers.

          • image (string) --

            The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with repository-url/image:tag .

          • cpu (integer) --

            The number of cpu units reserved for the container. A container instance has 1,024 cpu units for every CPU core. This parameter specifies the minimum amount of CPU to reserve for a container, and containers share unallocated CPU units with other containers on the instance with the same ratio as their allocated amount.

            For example, if you run a single-container task on a single-core instance type with 512 CPU units specified for that container, and that is the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task would be guaranteed a minimum of 512 CPU units when needed, and each container could float to higher CPU usage if the other container was not using it, but if both tasks were 100% active all of the time, they would be limited to 512 CPU units.

            If this parameter is omitted, 0 CPU units are reserved for the container, and it will only receive CPU time when other containers are not using it.

          • memory (integer) --

            The number of MiB of memory reserved for the container. If your container attempts to exceed the memory allocated here, the container is killed.

          • links (list) --

            The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter. The name:internalName construct is analogous to name:alias in Docker links. For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/.

            Warning

            Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.

            • (string) --

          • portMappings (list) --

            The list of port mappings for the container.

            • (dict) --

              Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part of the container definition.

              • containerPort (integer) --

                The port number on the container that is bound to the user-specified or automatically assigned host port. If you specify a container port and not a host port, your container will automatically receive a host port in the 49153 to 65535 port range.

              • hostPort (integer) --

                The port number on the container instance to reserve for your container. You can specify a non-reserved host port for your container port mapping, or you can omit the hostPort (or set it to 0 ) while specifying a containerPort and your container will automatically receive a port in the 49153 to 65535 port range. You should not attempt to specify a host port in the 49153 to 65535 port range, since these are reserved for automatic assignment.

                The default reserved ports are 22 for SSH, the Docker ports 2375 and 2376, and the Amazon ECS Container Agent port 51678. Any host port that was previously specified in a running task is also reserved while the task is running (once a task stops, the host port is released).The current reserved ports are displayed in the remainingResources of DescribeContainerInstances output, and a container instance may have up to 50 reserved ports at a time, including the default reserved ports (automatically assigned ports do not count toward this limit).

              • protocol (string) --

                The protocol used for the port mapping. The default is tcp .

          • essential (boolean) --

            If the essential parameter of a container is marked as true , the failure of that container will stop the task. If the essential parameter of a container is marked as false , then its failure will not affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.

            Note

            All tasks must have at least one essential container.

          • entryPoint (list) --

            Warning

            Early versions of the Amazon ECS container agent do not properly handle entryPoint parameters. If you have problems using entryPoint , update your container agent or enter your commands and arguments as command array items instead.

            The ENTRYPOINT that is passed to the container. For more information on the Docker ENTRYPOINT parameter, see https://docs.docker.com/reference/builder/#entrypoint.

            • (string) --

          • command (list) --

            The CMD that is passed to the container. For more information on the Docker CMD parameter, see https://docs.docker.com/reference/builder/#cmd.

            • (string) --

          • environment (list) --

            The environment variables to pass to a container.

            • (dict) --

              • name (string) --

                The name of the key value pair.

              • value (string) --

                The value of the key value pair.

          • mountPoints (list) --

            The mount points for data volumes in your container.

            • (dict) --

              • sourceVolume (string) --

                The name of the volume to mount.

              • containerPath (string) --

                The path on the container to mount the host volume at.

              • readOnly (boolean) --

                If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

          • volumesFrom (list) --

            Data volumes to mount from another container.

            • (dict) --

              • sourceContainer (string) --

                The name of the container to mount volumes from.

              • readOnly (boolean) --

                If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. The default value is false .

      • family (string) --

        The family of your task definition. You can think of the family as the name of your task definition.

      • revision (integer) --

        The revision of the task in a particular family. You can think of the revision as a version number of a task definition in a family. When you register a task definition for the first time, the revision is 1 , and each time you register a task definition in the same family, the revision value increases by one.

      • volumes (list) --

        The list of volumes in a task. For more information on volume definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .

        • (dict) --

          • name (string) --

            The name of the volume. This name is referenced in the sourceVolume parameter of container definition mountPoints .

          • host (dict) --

            The path on the host container instance that is presented to the containers which access the volume. If this parameter is empty, then the Docker daemon assigns a host path for you.

            • sourcePath (string) --

              The path on the host container instance that is presented to the container. If this parameter is empty, then the Docker daemon has assigned a host path for you.

RunTask (updated) Link ¶
Changes (response)
{'tasks': {'containers': {'networkBindings': {'protocol': 'tcp | udp'}}}}

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

An optional tag specified when a task is started. For example if you automatically trigger a task to run a batch process job, you could apply a unique identifier for that job to your task with the startedBy parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks call with the startedBy value.

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

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,
                            'protocol': 'tcp'|'udp'
                        },
                    ]
                },
            ],
            '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.

                • protocol (string) --

                  The protocol used for the network binding.

        • 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.

    • 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 (response)
{'tasks': {'containers': {'networkBindings': {'protocol': 'tcp | udp'}}}}

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

An optional tag specified when a task is started. For example if you automatically trigger a task to run a batch process job, you could apply a unique identifier for that job to your task with the startedBy parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks call with the startedBy value.

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

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,
                            'protocol': 'tcp'|'udp'
                        },
                    ]
                },
            ],
            '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.

                • protocol (string) --

                  The protocol used for the network binding.

        • 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.

    • 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': {'containers': {'networkBindings': {'protocol': 'tcp | udp'}}}}

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,
                        'protocol': 'tcp'|'udp'
                    },
                ]
            },
        ],
        '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.

              • protocol (string) --

                The protocol used for the network binding.

      • 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.

SubmitContainerStateChange (updated) Link ¶
Changes (request)
{'networkBindings': {'protocol': 'tcp | udp'}}

Note

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

Sent to acknowledge that a container changed states.

Request Syntax

client.submit_container_state_change(
    cluster='string',
    task='string',
    containerName='string',
    status='string',
    exitCode=123,
    reason='string',
    networkBindings=[
        {
            'bindIP': 'string',
            'containerPort': 123,
            'hostPort': 123,
            'protocol': 'tcp'|'udp'
        },
    ]
)
type cluster

string

param cluster

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container.

type task

string

param task

The task UUID or full Amazon Resource Name (ARN) of the task that hosts the container.

type containerName

string

param containerName

The name of the container.

type status

string

param status

The status of the state change request.

type exitCode

integer

param exitCode

The exit code returned for the state change request.

type reason

string

param reason

The reason for the state change request.

type networkBindings

list

param networkBindings

The network bindings of the container.

  • (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.

    • protocol (string) --

      The protocol used for the network binding.

rtype

dict

returns

Response Syntax

{
    'acknowledgment': 'string'
}

Response Structure

  • (dict) --

    • acknowledgment (string) --

      Acknowledgement of the state change.