Amazon EC2 Container Service

2015/10/07 - Amazon EC2 Container Service - 7 updated api methods

DeregisterContainerInstance (updated) Link ¶
Changes (response)
{'containerInstance': {'attributes': [{'name': 'string', 'value': 'string'}]}}

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

If you intend to use the container instance for some other purpose after deregistration, you should stop all of the tasks running on the container instance before deregistration to avoid any orphaned tasks from consuming resources.

Deregistering a container instance removes the instance from a cluster, but it does not terminate the EC2 instance; if you are finished using the instance, be sure to terminate it in the Amazon EC2 console to stop billing.

Note

When you terminate a container instance, it is automatically deregistered from your cluster.

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 to deregister. If you do not specify a cluster, the default cluster is assumed.

type containerInstance

string

param containerInstance

[REQUIRED]

The container instance ID or full Amazon Resource Name (ARN) of the container instance 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 ID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_ID .

type force

boolean

param force

Forces the deregistration of the container instance. If you have tasks running on the container instance when you deregister it with the force option, these tasks remain running and they continue to pass Elastic Load Balancing load balancer health checks until you terminate the instance or the tasks stop through some other means, but they are orphaned (no longer monitored or accounted for by Amazon ECS). If an orphaned task on your container instance is part of an Amazon ECS service, then the service scheduler starts another copy of that task, on a different container instance if possible.

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',
        'attributes': [
            {
                'name': 'string',
                'value': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • containerInstance (dict) --

      An 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 ID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_ID .

      • ec2InstanceId (string) --

        The 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 return false , and instances without a connected agent cannot accept placement requests.

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

      • attributes (list) --

        The attributes set for the container instance by the Amazon ECS container agent at instance registration.

        • (dict) --

          The attributes applicable to a container instance when it is registered.

          • name (string) --

            The name of the container instance attribute.

          • value (string) --

            The value of the container instance attribute.

DeregisterTaskDefinition (updated) Link ¶
Changes (response)
{'taskDefinition': {'containerDefinitions': {'disableNetworking': 'boolean',
                                             'dnsSearchDomains': ['string'],
                                             'dnsServers': ['string'],
                                             'dockerLabels': {'string': 'string'},
                                             'dockerSecurityOptions': ['string'],
                                             'extraHosts': [{'hostname': 'string',
                                                             'ipAddress': 'string'}],
                                             'hostname': 'string',
                                             'logConfiguration': {'logDriver': 'json-file '
                                                                               '| '
                                                                               'syslog '
                                                                               '| '
                                                                               'journald '
                                                                               '| '
                                                                               'gelf '
                                                                               '| '
                                                                               'fluentd',
                                                                  'options': {'string': 'string'}},
                                             'privileged': 'boolean',
                                             'readonlyRootFilesystem': 'boolean',
                                             'ulimits': [{'hardLimit': 'integer',
                                                          'name': 'core | cpu '
                                                                  '| data | '
                                                                  'fsize | '
                                                                  'locks | '
                                                                  'memlock | '
                                                                  'msgqueue | '
                                                                  'nice | '
                                                                  'nofile | '
                                                                  'nproc | rss '
                                                                  '| rtprio | '
                                                                  'rttime | '
                                                                  'sigpending '
                                                                  '| stack',
                                                          'softLimit': 'integer'}],
                                             'user': 'string',
                                             'workingDirectory': 'string'},
                    'requiresAttributes': [{'name': 'string',
                                            'value': 'string'}]}}

Deregisters the specified task definition by family and revision. Upon deregistration, the task definition is marked as INACTIVE . Existing tasks and services that reference an INACTIVE task definition continue to run without disruption. Existing services that reference an INACTIVE task definition can still scale up or down by modifying the service's desired count.

You cannot use an INACTIVE task definition to run new tasks or create new services, and you cannot update an existing service to reference an INACTIVE task definition (although there may be up to a 10 minute window following deregistration where these restrictions have not yet taken effect).

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 to deregister. You must specify a revision .

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
                    },
                ],
                'hostname': 'string',
                'user': 'string',
                'workingDirectory': 'string',
                'disableNetworking': True|False,
                'privileged': True|False,
                'readonlyRootFilesystem': True|False,
                'dnsServers': [
                    'string',
                ],
                'dnsSearchDomains': [
                    'string',
                ],
                'extraHosts': [
                    {
                        'hostname': 'string',
                        'ipAddress': 'string'
                    },
                ],
                'dockerSecurityOptions': [
                    'string',
                ],
                'dockerLabels': {
                    'string': 'string'
                },
                'ulimits': [
                    {
                        'name': 'core'|'cpu'|'data'|'fsize'|'locks'|'memlock'|'msgqueue'|'nice'|'nofile'|'nproc'|'rss'|'rtprio'|'rttime'|'sigpending'|'stack',
                        'softLimit': 123,
                        'hardLimit': 123
                    },
                ],
                'logConfiguration': {
                    'logDriver': 'json-file'|'syslog'|'journald'|'gelf'|'fluentd',
                    'options': {
                        'string': 'string'
                    }
                }
            },
        ],
        'family': 'string',
        'revision': 123,
        'volumes': [
            {
                'name': 'string',
                'host': {
                    'sourcePath': 'string'
                }
            },
        ],
        'status': 'ACTIVE'|'INACTIVE',
        'requiresAttributes': [
            {
                'name': 'string',
                'value': '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 about 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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run.

          • 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 . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run.

          • 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. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run.

            Note

            You can determine the number of CPU units that are available per EC2 instance type by multiplying the vCPUs listed for that instance type on the Amazon EC2 Instances detail page by 1,024.

            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.

            The Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2; however, the CPU parameter is not required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version:

            • Agent versions less than or equal to 1.1.0: Null and zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to 2 CPU shares.

            • Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values of 1 are passed to Docker as 2.

          • 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. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run.

          • links (list) --

            The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter and optionally, an alias for the link. This construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed for each name and alias . For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run.

            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. Port mappings allow containers to access ports on the host container instance to send or receive traffic. This parameter maps to PortBindings in the Create a container section of the Docker Remote API and the --publish option to docker run.

            • (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. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.

              • 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 automatically receives a host port in the ephemeral port range (for more information, see hostPort ).

              • 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 automatically receives a port in the ephemeral port range for your container instance operating system and Docker version.

                The default ephemeral port range is 49153 to 65535, and this range is used for Docker versions prior to 1.6.0. For Docker version 1.6.0 and later, the Docker daemon tries to read the ephemeral port range from /proc/sys/net/ipv4/ip_local_port_range ; if this kernel parameter is unavailable, the default ephemeral port range is used. You should not attempt to specify a host port in the ephemeral port range, because these are reserved for automatic assignment. In general, ports below 32768 are outside of the ephemeral port range.

                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 (after 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. Valid values are tcp and udp . The default is tcp .

          • essential (boolean) --

            If the essential parameter of a container is marked as true , the failure of that container stops the task. If the essential parameter of a container is marked as false , then its failure does 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 entry point that is passed to the container. This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run. For more information, see https://docs.docker.com/reference/builder/#entrypoint.

            • (string) --

          • command (list) --

            The command that is passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run. For more information, see https://docs.docker.com/reference/builder/#cmd.

            • (string) --

          • environment (list) --

            The environment variables to pass to a container. This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run.

            • (dict) --

              A key and value pair object.

              • name (string) --

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

              • value (string) --

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

          • mountPoints (list) --

            The mount points for data volumes in your container. This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run.

            • (dict) --

              Details on a volume mount point that is used in a container definition.

              • 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. This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run.

            • (dict) --

              Details on a data volume from another container.

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

          • hostname (string) --

            The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run.

          • user (string) --

            The user name to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

          • workingDirectory (string) --

            The working directory in which to run commands inside the container. This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run.

          • disableNetworking (boolean) --

            When this parameter is true, networking is disabled within the container. This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API.

          • privileged (boolean) --

            When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run.

          • readonlyRootFilesystem (boolean) --

            When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .

          • dnsServers (list) --

            A list of DNS servers that are presented to the container. This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run.

            • (string) --

          • dnsSearchDomains (list) --

            A list of DNS search domains that are presented to the container. This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run.

            • (string) --

          • extraHosts (list) --

            A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run.

            • (dict) --

              Hostnames and IP address entries that are added to the /etc/hosts file of a container via the extraHosts parameter of its ContainerDefinition.

              • hostname (string) --

                The hostname to use in the /etc/hosts entry.

              • ipAddress (string) --

                The IP address to use in the /etc/hosts entry.

          • dockerSecurityOptions (list) --

            A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. This parameter maps to SecurityOpt in the Create a container section of the Docker Remote API and the --security-opt option to docker run.

            Note

            The Amazon ECS container agent running on a container instance must register with the ECS_SELINUX_CAPABLE=true or ECS_APPARMOR_CAPABLE=true environment variables before containers placed on that instance can use these security options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

            • (string) --

          • dockerLabels (dict) --

            A key/value map of labels to add to the container. This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • (string) --

              • (string) --

          • ulimits (list) --

            A list of ulimits to set in the container. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run. Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • (dict) --

              The ulimit settings to pass to the container.

              • name (string) --

                The type of the ulimit .

              • softLimit (integer) --

                The soft limit for the ulimit type.

              • hardLimit (integer) --

                The hard limit for the ulimit type.

          • logConfiguration (dict) --

            The log configuration specification for the container. This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run. Valid log drivers are displayed in the LogConfiguration data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            Note

            The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

            • logDriver (string) --

              The log driver to use for the container. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • options (dict) --

              The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

              • (string) --

                • (string) --

      • family (string) --

        The family of your task definition, used as the definition name.

      • revision (integer) --

        The revision of the task in a particular family. The revision is a version number of a task definition in a family. When you register a task definition for the first time, the revision is 1 ; each time you register a new revision of a task definition in the same family, the revision value always increases by one (even if you have deregistered previous revisions in this family).

      • volumes (list) --

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

        • (dict) --

          A data volume used in a task definition.

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

      • status (string) --

        The status of the task definition.

      • requiresAttributes (list) --

        The container instance attributes required by your task.

        • (dict) --

          The attributes applicable to a container instance when it is registered.

          • name (string) --

            The name of the container instance attribute.

          • value (string) --

            The value of the container instance attribute.

DescribeContainerInstances (updated) Link ¶
Changes (response)
{'containerInstances': {'attributes': [{'name': 'string', 'value': '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 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 IDs 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',
            'attributes': [
                {
                    'name': 'string',
                    'value': 'string'
                },
            ]
        },
    ],
    'failures': [
        {
            'arn': 'string',
            'reason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • containerInstances (list) --

      The list of container instances.

      • (dict) --

        An 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 ID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_ID .

        • ec2InstanceId (string) --

          The 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 return false , and instances without a connected agent cannot accept placement requests.

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

        • attributes (list) --

          The attributes set for the container instance by the Amazon ECS container agent at instance registration.

          • (dict) --

            The attributes applicable to a container instance when it is registered.

            • name (string) --

              The name of the container instance attribute.

            • value (string) --

              The value of the container instance attribute.

    • failures (list) --

      Any failures associated with the call.

      • (dict) --

        A failed resource.

        • 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': {'disableNetworking': 'boolean',
                                             'dnsSearchDomains': ['string'],
                                             'dnsServers': ['string'],
                                             'dockerLabels': {'string': 'string'},
                                             'dockerSecurityOptions': ['string'],
                                             'extraHosts': [{'hostname': 'string',
                                                             'ipAddress': 'string'}],
                                             'hostname': 'string',
                                             'logConfiguration': {'logDriver': 'json-file '
                                                                               '| '
                                                                               'syslog '
                                                                               '| '
                                                                               'journald '
                                                                               '| '
                                                                               'gelf '
                                                                               '| '
                                                                               'fluentd',
                                                                  'options': {'string': 'string'}},
                                             'privileged': 'boolean',
                                             'readonlyRootFilesystem': 'boolean',
                                             'ulimits': [{'hardLimit': 'integer',
                                                          'name': 'core | cpu '
                                                                  '| data | '
                                                                  'fsize | '
                                                                  'locks | '
                                                                  'memlock | '
                                                                  'msgqueue | '
                                                                  'nice | '
                                                                  'nofile | '
                                                                  'nproc | rss '
                                                                  '| rtprio | '
                                                                  'rttime | '
                                                                  'sigpending '
                                                                  '| stack',
                                                          'softLimit': 'integer'}],
                                             'user': 'string',
                                             'workingDirectory': 'string'},
                    'requiresAttributes': [{'name': 'string',
                                            'value': 'string'}]}}

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

Note

You can only describe INACTIVE task definitions while an active task or service references them.

Request Syntax

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

string

param taskDefinition

[REQUIRED]

The family for the latest ACTIVE revision, family and revision ( family:revision ) for a specific revision in the family, or full Amazon Resource Name (ARN) of the task definition 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
                    },
                ],
                'hostname': 'string',
                'user': 'string',
                'workingDirectory': 'string',
                'disableNetworking': True|False,
                'privileged': True|False,
                'readonlyRootFilesystem': True|False,
                'dnsServers': [
                    'string',
                ],
                'dnsSearchDomains': [
                    'string',
                ],
                'extraHosts': [
                    {
                        'hostname': 'string',
                        'ipAddress': 'string'
                    },
                ],
                'dockerSecurityOptions': [
                    'string',
                ],
                'dockerLabels': {
                    'string': 'string'
                },
                'ulimits': [
                    {
                        'name': 'core'|'cpu'|'data'|'fsize'|'locks'|'memlock'|'msgqueue'|'nice'|'nofile'|'nproc'|'rss'|'rtprio'|'rttime'|'sigpending'|'stack',
                        'softLimit': 123,
                        'hardLimit': 123
                    },
                ],
                'logConfiguration': {
                    'logDriver': 'json-file'|'syslog'|'journald'|'gelf'|'fluentd',
                    'options': {
                        'string': 'string'
                    }
                }
            },
        ],
        'family': 'string',
        'revision': 123,
        'volumes': [
            {
                'name': 'string',
                'host': {
                    'sourcePath': 'string'
                }
            },
        ],
        'status': 'ACTIVE'|'INACTIVE',
        'requiresAttributes': [
            {
                'name': 'string',
                'value': '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 about 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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run.

          • 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 . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run.

          • 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. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run.

            Note

            You can determine the number of CPU units that are available per EC2 instance type by multiplying the vCPUs listed for that instance type on the Amazon EC2 Instances detail page by 1,024.

            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.

            The Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2; however, the CPU parameter is not required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version:

            • Agent versions less than or equal to 1.1.0: Null and zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to 2 CPU shares.

            • Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values of 1 are passed to Docker as 2.

          • 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. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run.

          • links (list) --

            The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter and optionally, an alias for the link. This construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed for each name and alias . For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run.

            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. Port mappings allow containers to access ports on the host container instance to send or receive traffic. This parameter maps to PortBindings in the Create a container section of the Docker Remote API and the --publish option to docker run.

            • (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. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.

              • 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 automatically receives a host port in the ephemeral port range (for more information, see hostPort ).

              • 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 automatically receives a port in the ephemeral port range for your container instance operating system and Docker version.

                The default ephemeral port range is 49153 to 65535, and this range is used for Docker versions prior to 1.6.0. For Docker version 1.6.0 and later, the Docker daemon tries to read the ephemeral port range from /proc/sys/net/ipv4/ip_local_port_range ; if this kernel parameter is unavailable, the default ephemeral port range is used. You should not attempt to specify a host port in the ephemeral port range, because these are reserved for automatic assignment. In general, ports below 32768 are outside of the ephemeral port range.

                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 (after 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. Valid values are tcp and udp . The default is tcp .

          • essential (boolean) --

            If the essential parameter of a container is marked as true , the failure of that container stops the task. If the essential parameter of a container is marked as false , then its failure does 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 entry point that is passed to the container. This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run. For more information, see https://docs.docker.com/reference/builder/#entrypoint.

            • (string) --

          • command (list) --

            The command that is passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run. For more information, see https://docs.docker.com/reference/builder/#cmd.

            • (string) --

          • environment (list) --

            The environment variables to pass to a container. This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run.

            • (dict) --

              A key and value pair object.

              • name (string) --

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

              • value (string) --

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

          • mountPoints (list) --

            The mount points for data volumes in your container. This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run.

            • (dict) --

              Details on a volume mount point that is used in a container definition.

              • 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. This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run.

            • (dict) --

              Details on a data volume from another container.

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

          • hostname (string) --

            The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run.

          • user (string) --

            The user name to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

          • workingDirectory (string) --

            The working directory in which to run commands inside the container. This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run.

          • disableNetworking (boolean) --

            When this parameter is true, networking is disabled within the container. This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API.

          • privileged (boolean) --

            When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run.

          • readonlyRootFilesystem (boolean) --

            When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .

          • dnsServers (list) --

            A list of DNS servers that are presented to the container. This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run.

            • (string) --

          • dnsSearchDomains (list) --

            A list of DNS search domains that are presented to the container. This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run.

            • (string) --

          • extraHosts (list) --

            A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run.

            • (dict) --

              Hostnames and IP address entries that are added to the /etc/hosts file of a container via the extraHosts parameter of its ContainerDefinition.

              • hostname (string) --

                The hostname to use in the /etc/hosts entry.

              • ipAddress (string) --

                The IP address to use in the /etc/hosts entry.

          • dockerSecurityOptions (list) --

            A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. This parameter maps to SecurityOpt in the Create a container section of the Docker Remote API and the --security-opt option to docker run.

            Note

            The Amazon ECS container agent running on a container instance must register with the ECS_SELINUX_CAPABLE=true or ECS_APPARMOR_CAPABLE=true environment variables before containers placed on that instance can use these security options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

            • (string) --

          • dockerLabels (dict) --

            A key/value map of labels to add to the container. This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • (string) --

              • (string) --

          • ulimits (list) --

            A list of ulimits to set in the container. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run. Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • (dict) --

              The ulimit settings to pass to the container.

              • name (string) --

                The type of the ulimit .

              • softLimit (integer) --

                The soft limit for the ulimit type.

              • hardLimit (integer) --

                The hard limit for the ulimit type.

          • logConfiguration (dict) --

            The log configuration specification for the container. This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run. Valid log drivers are displayed in the LogConfiguration data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            Note

            The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

            • logDriver (string) --

              The log driver to use for the container. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • options (dict) --

              The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

              • (string) --

                • (string) --

      • family (string) --

        The family of your task definition, used as the definition name.

      • revision (integer) --

        The revision of the task in a particular family. The revision is a version number of a task definition in a family. When you register a task definition for the first time, the revision is 1 ; each time you register a new revision of a task definition in the same family, the revision value always increases by one (even if you have deregistered previous revisions in this family).

      • volumes (list) --

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

        • (dict) --

          A data volume used in a task definition.

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

      • status (string) --

        The status of the task definition.

      • requiresAttributes (list) --

        The container instance attributes required by your task.

        • (dict) --

          The attributes applicable to a container instance when it is registered.

          • name (string) --

            The name of the container instance attribute.

          • value (string) --

            The value of the container instance attribute.

RegisterContainerInstance (updated) Link ¶
Changes (request, response)
Request
{'attributes': [{'name': 'string', 'value': 'string'}]}
Response
{'containerInstance': {'attributes': [{'name': 'string', 'value': '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 EC2 instance into the specified cluster. This instance becomes 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'
    },
    containerInstanceArn='string',
    attributes=[
        {
            'name': 'string',
            'value': 'string'
        },
    ]
)
type cluster

string

param cluster

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

type instanceIdentityDocument

string

param instanceIdentityDocument

The instance identity document for the 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 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.

type containerInstanceArn

string

param containerInstanceArn

The Amazon Resource Name (ARN) of the container instance (if it was previously registered).

type attributes

list

param attributes

The container instance attributes that this container instance supports.

  • (dict) --

    The attributes applicable to a container instance when it is registered.

    • name (string) -- [REQUIRED]

      The name of the container instance attribute.

    • value (string) --

      The value of the container instance attribute.

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',
        'attributes': [
            {
                'name': 'string',
                'value': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • containerInstance (dict) --

      An 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 ID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_ID .

      • ec2InstanceId (string) --

        The 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 return false , and instances without a connected agent cannot accept placement requests.

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

      • attributes (list) --

        The attributes set for the container instance by the Amazon ECS container agent at instance registration.

        • (dict) --

          The attributes applicable to a container instance when it is registered.

          • name (string) --

            The name of the container instance attribute.

          • value (string) --

            The value of the container instance attribute.

RegisterTaskDefinition (updated) Link ¶
Changes (request, response)
Request
{'containerDefinitions': {'disableNetworking': 'boolean',
                          'dnsSearchDomains': ['string'],
                          'dnsServers': ['string'],
                          'dockerLabels': {'string': 'string'},
                          'dockerSecurityOptions': ['string'],
                          'extraHosts': [{'hostname': 'string',
                                          'ipAddress': 'string'}],
                          'hostname': 'string',
                          'logConfiguration': {'logDriver': 'json-file | '
                                                            'syslog | journald '
                                                            '| gelf | fluentd',
                                               'options': {'string': 'string'}},
                          'privileged': 'boolean',
                          'readonlyRootFilesystem': 'boolean',
                          'ulimits': [{'hardLimit': 'integer',
                                       'name': 'core | cpu | data | fsize | '
                                               'locks | memlock | msgqueue | '
                                               'nice | nofile | nproc | rss | '
                                               'rtprio | rttime | sigpending | '
                                               'stack',
                                       'softLimit': 'integer'}],
                          'user': 'string',
                          'workingDirectory': 'string'}}
Response
{'taskDefinition': {'containerDefinitions': {'disableNetworking': 'boolean',
                                             'dnsSearchDomains': ['string'],
                                             'dnsServers': ['string'],
                                             'dockerLabels': {'string': 'string'},
                                             'dockerSecurityOptions': ['string'],
                                             'extraHosts': [{'hostname': 'string',
                                                             'ipAddress': 'string'}],
                                             'hostname': 'string',
                                             'logConfiguration': {'logDriver': 'json-file '
                                                                               '| '
                                                                               'syslog '
                                                                               '| '
                                                                               'journald '
                                                                               '| '
                                                                               'gelf '
                                                                               '| '
                                                                               'fluentd',
                                                                  'options': {'string': 'string'}},
                                             'privileged': 'boolean',
                                             'readonlyRootFilesystem': 'boolean',
                                             'ulimits': [{'hardLimit': 'integer',
                                                          'name': 'core | cpu '
                                                                  '| data | '
                                                                  'fsize | '
                                                                  'locks | '
                                                                  'memlock | '
                                                                  'msgqueue | '
                                                                  'nice | '
                                                                  'nofile | '
                                                                  'nproc | rss '
                                                                  '| rtprio | '
                                                                  'rttime | '
                                                                  'sigpending '
                                                                  '| stack',
                                                          'softLimit': 'integer'}],
                                             'user': 'string',
                                             'workingDirectory': 'string'},
                    'requiresAttributes': [{'name': 'string',
                                            'value': 'string'}]}}

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 about 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
                },
            ],
            'hostname': 'string',
            'user': 'string',
            'workingDirectory': 'string',
            'disableNetworking': True|False,
            'privileged': True|False,
            'readonlyRootFilesystem': True|False,
            'dnsServers': [
                'string',
            ],
            'dnsSearchDomains': [
                'string',
            ],
            'extraHosts': [
                {
                    'hostname': 'string',
                    'ipAddress': 'string'
                },
            ],
            'dockerSecurityOptions': [
                'string',
            ],
            'dockerLabels': {
                'string': 'string'
            },
            'ulimits': [
                {
                    'name': 'core'|'cpu'|'data'|'fsize'|'locks'|'memlock'|'msgqueue'|'nice'|'nofile'|'nproc'|'rss'|'rtprio'|'rttime'|'sigpending'|'stack',
                    'softLimit': 123,
                    'hardLimit': 123
                },
            ],
            'logConfiguration': {
                'logDriver': 'json-file'|'syslog'|'journald'|'gelf'|'fluentd',
                'options': {
                    'string': 'string'
                }
            }
        },
    ],
    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. The family is used 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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run.

    • 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 . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run.

    • 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. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run.

      Note

      You can determine the number of CPU units that are available per EC2 instance type by multiplying the vCPUs listed for that instance type on the Amazon EC2 Instances detail page by 1,024.

      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.

      The Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2; however, the CPU parameter is not required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version:

      • Agent versions less than or equal to 1.1.0: Null and zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to 2 CPU shares.

      • Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values of 1 are passed to Docker as 2.

    • 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. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run.

    • links (list) --

      The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter and optionally, an alias for the link. This construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed for each name and alias . For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run.

      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. Port mappings allow containers to access ports on the host container instance to send or receive traffic. This parameter maps to PortBindings in the Create a container section of the Docker Remote API and the --publish option to docker run.

      • (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. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.

        • 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 automatically receives a host port in the ephemeral port range (for more information, see hostPort ).

        • 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 automatically receives a port in the ephemeral port range for your container instance operating system and Docker version.

          The default ephemeral port range is 49153 to 65535, and this range is used for Docker versions prior to 1.6.0. For Docker version 1.6.0 and later, the Docker daemon tries to read the ephemeral port range from /proc/sys/net/ipv4/ip_local_port_range ; if this kernel parameter is unavailable, the default ephemeral port range is used. You should not attempt to specify a host port in the ephemeral port range, because these are reserved for automatic assignment. In general, ports below 32768 are outside of the ephemeral port range.

          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 (after 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. Valid values are tcp and udp . The default is tcp .

    • essential (boolean) --

      If the essential parameter of a container is marked as true , the failure of that container stops the task. If the essential parameter of a container is marked as false , then its failure does 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 entry point that is passed to the container. This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run. For more information, see https://docs.docker.com/reference/builder/#entrypoint.

      • (string) --

    • command (list) --

      The command that is passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run. For more information, see https://docs.docker.com/reference/builder/#cmd.

      • (string) --

    • environment (list) --

      The environment variables to pass to a container. This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run.

      • (dict) --

        A key and value pair object.

        • name (string) --

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

        • value (string) --

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

    • mountPoints (list) --

      The mount points for data volumes in your container. This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run.

      • (dict) --

        Details on a volume mount point that is used in a container definition.

        • 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. This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run.

      • (dict) --

        Details on a data volume from another container.

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

    • hostname (string) --

      The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run.

    • user (string) --

      The user name to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

    • workingDirectory (string) --

      The working directory in which to run commands inside the container. This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run.

    • disableNetworking (boolean) --

      When this parameter is true, networking is disabled within the container. This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API.

    • privileged (boolean) --

      When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run.

    • readonlyRootFilesystem (boolean) --

      When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .

    • dnsServers (list) --

      A list of DNS servers that are presented to the container. This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run.

      • (string) --

    • dnsSearchDomains (list) --

      A list of DNS search domains that are presented to the container. This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run.

      • (string) --

    • extraHosts (list) --

      A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run.

      • (dict) --

        Hostnames and IP address entries that are added to the /etc/hosts file of a container via the extraHosts parameter of its ContainerDefinition.

        • hostname (string) -- [REQUIRED]

          The hostname to use in the /etc/hosts entry.

        • ipAddress (string) -- [REQUIRED]

          The IP address to use in the /etc/hosts entry.

    • dockerSecurityOptions (list) --

      A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. This parameter maps to SecurityOpt in the Create a container section of the Docker Remote API and the --security-opt option to docker run.

      Note

      The Amazon ECS container agent running on a container instance must register with the ECS_SELINUX_CAPABLE=true or ECS_APPARMOR_CAPABLE=true environment variables before containers placed on that instance can use these security options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

      • (string) --

    • dockerLabels (dict) --

      A key/value map of labels to add to the container. This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

      • (string) --

        • (string) --

    • ulimits (list) --

      A list of ulimits to set in the container. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run. Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

      • (dict) --

        The ulimit settings to pass to the container.

        • name (string) -- [REQUIRED]

          The type of the ulimit .

        • softLimit (integer) -- [REQUIRED]

          The soft limit for the ulimit type.

        • hardLimit (integer) -- [REQUIRED]

          The hard limit for the ulimit type.

    • logConfiguration (dict) --

      The log configuration specification for the container. This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run. Valid log drivers are displayed in the LogConfiguration data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

      Note

      The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

      • logDriver (string) -- [REQUIRED]

        The log driver to use for the container. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

      • options (dict) --

        The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

        • (string) --

          • (string) --

type volumes

list

param volumes

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

  • (dict) --

    A data volume used in a task definition.

    • 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
                    },
                ],
                'hostname': 'string',
                'user': 'string',
                'workingDirectory': 'string',
                'disableNetworking': True|False,
                'privileged': True|False,
                'readonlyRootFilesystem': True|False,
                'dnsServers': [
                    'string',
                ],
                'dnsSearchDomains': [
                    'string',
                ],
                'extraHosts': [
                    {
                        'hostname': 'string',
                        'ipAddress': 'string'
                    },
                ],
                'dockerSecurityOptions': [
                    'string',
                ],
                'dockerLabels': {
                    'string': 'string'
                },
                'ulimits': [
                    {
                        'name': 'core'|'cpu'|'data'|'fsize'|'locks'|'memlock'|'msgqueue'|'nice'|'nofile'|'nproc'|'rss'|'rtprio'|'rttime'|'sigpending'|'stack',
                        'softLimit': 123,
                        'hardLimit': 123
                    },
                ],
                'logConfiguration': {
                    'logDriver': 'json-file'|'syslog'|'journald'|'gelf'|'fluentd',
                    'options': {
                        'string': 'string'
                    }
                }
            },
        ],
        'family': 'string',
        'revision': 123,
        'volumes': [
            {
                'name': 'string',
                'host': {
                    'sourcePath': 'string'
                }
            },
        ],
        'status': 'ACTIVE'|'INACTIVE',
        'requiresAttributes': [
            {
                'name': 'string',
                'value': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • taskDefinition (dict) --

      The full description of the registered task definition.

      • 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 about 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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run.

          • 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 . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run.

          • 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. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run.

            Note

            You can determine the number of CPU units that are available per EC2 instance type by multiplying the vCPUs listed for that instance type on the Amazon EC2 Instances detail page by 1,024.

            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.

            The Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2; however, the CPU parameter is not required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version:

            • Agent versions less than or equal to 1.1.0: Null and zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to 2 CPU shares.

            • Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values of 1 are passed to Docker as 2.

          • 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. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run.

          • links (list) --

            The link parameter allows containers to communicate with each other without the need for port mappings, using the name parameter and optionally, an alias for the link. This construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed for each name and alias . For more information on linking Docker containers, see https://docs.docker.com/userguide/dockerlinks/. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run.

            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. Port mappings allow containers to access ports on the host container instance to send or receive traffic. This parameter maps to PortBindings in the Create a container section of the Docker Remote API and the --publish option to docker run.

            • (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. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.

              • 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 automatically receives a host port in the ephemeral port range (for more information, see hostPort ).

              • 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 automatically receives a port in the ephemeral port range for your container instance operating system and Docker version.

                The default ephemeral port range is 49153 to 65535, and this range is used for Docker versions prior to 1.6.0. For Docker version 1.6.0 and later, the Docker daemon tries to read the ephemeral port range from /proc/sys/net/ipv4/ip_local_port_range ; if this kernel parameter is unavailable, the default ephemeral port range is used. You should not attempt to specify a host port in the ephemeral port range, because these are reserved for automatic assignment. In general, ports below 32768 are outside of the ephemeral port range.

                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 (after 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. Valid values are tcp and udp . The default is tcp .

          • essential (boolean) --

            If the essential parameter of a container is marked as true , the failure of that container stops the task. If the essential parameter of a container is marked as false , then its failure does 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 entry point that is passed to the container. This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run. For more information, see https://docs.docker.com/reference/builder/#entrypoint.

            • (string) --

          • command (list) --

            The command that is passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run. For more information, see https://docs.docker.com/reference/builder/#cmd.

            • (string) --

          • environment (list) --

            The environment variables to pass to a container. This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run.

            • (dict) --

              A key and value pair object.

              • name (string) --

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

              • value (string) --

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

          • mountPoints (list) --

            The mount points for data volumes in your container. This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run.

            • (dict) --

              Details on a volume mount point that is used in a container definition.

              • 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. This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run.

            • (dict) --

              Details on a data volume from another container.

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

          • hostname (string) --

            The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run.

          • user (string) --

            The user name to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

          • workingDirectory (string) --

            The working directory in which to run commands inside the container. This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run.

          • disableNetworking (boolean) --

            When this parameter is true, networking is disabled within the container. This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API.

          • privileged (boolean) --

            When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run.

          • readonlyRootFilesystem (boolean) --

            When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .

          • dnsServers (list) --

            A list of DNS servers that are presented to the container. This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run.

            • (string) --

          • dnsSearchDomains (list) --

            A list of DNS search domains that are presented to the container. This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run.

            • (string) --

          • extraHosts (list) --

            A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run.

            • (dict) --

              Hostnames and IP address entries that are added to the /etc/hosts file of a container via the extraHosts parameter of its ContainerDefinition.

              • hostname (string) --

                The hostname to use in the /etc/hosts entry.

              • ipAddress (string) --

                The IP address to use in the /etc/hosts entry.

          • dockerSecurityOptions (list) --

            A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. This parameter maps to SecurityOpt in the Create a container section of the Docker Remote API and the --security-opt option to docker run.

            Note

            The Amazon ECS container agent running on a container instance must register with the ECS_SELINUX_CAPABLE=true or ECS_APPARMOR_CAPABLE=true environment variables before containers placed on that instance can use these security options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

            • (string) --

          • dockerLabels (dict) --

            A key/value map of labels to add to the container. This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • (string) --

              • (string) --

          • ulimits (list) --

            A list of ulimits to set in the container. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run. Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • (dict) --

              The ulimit settings to pass to the container.

              • name (string) --

                The type of the ulimit .

              • softLimit (integer) --

                The soft limit for the ulimit type.

              • hardLimit (integer) --

                The hard limit for the ulimit type.

          • logConfiguration (dict) --

            The log configuration specification for the container. This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run. Valid log drivers are displayed in the LogConfiguration data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            Note

            The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS Container Agent Configuration in the Amazon EC2 Container Service Developer Guide .

            • logDriver (string) --

              The log driver to use for the container. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

            • options (dict) --

              The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log into your container instance and run the following command: sudo docker version | grep "Server API version"

              • (string) --

                • (string) --

      • family (string) --

        The family of your task definition, used as the definition name.

      • revision (integer) --

        The revision of the task in a particular family. The revision is a version number of a task definition in a family. When you register a task definition for the first time, the revision is 1 ; each time you register a new revision of a task definition in the same family, the revision value always increases by one (even if you have deregistered previous revisions in this family).

      • volumes (list) --

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

        • (dict) --

          A data volume used in a task definition.

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

      • status (string) --

        The status of the task definition.

      • requiresAttributes (list) --

        The container instance attributes required by your task.

        • (dict) --

          The attributes applicable to a container instance when it is registered.

          • name (string) --

            The name of the container instance attribute.

          • value (string) --

            The value of the container instance attribute.

UpdateContainerAgent (updated) Link ¶
Changes (response)
{'containerInstance': {'attributes': [{'name': 'string', 'value': 'string'}]}}

Updates the Amazon ECS container agent on a specified container instance. Updating the Amazon ECS container agent does not interrupt running tasks or services on the container instance. The process for updating the agent differs depending on whether your container instance was launched with the Amazon ECS-optimized AMI or another operating system.

UpdateContainerAgent requires the Amazon ECS-optimized AMI or Amazon Linux with the ecs-init service installed and running. For help updating the Amazon ECS container agent on other operating systems, see Manually Updating the Amazon ECS Container Agent in the Amazon EC2 Container Service Developer Guide .

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 ID 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',
        'attributes': [
            {
                'name': 'string',
                'value': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • containerInstance (dict) --

      An 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 ID. For example, arn:aws:ecs:region :aws_account_id :container-instance/container_instance_ID .

      • ec2InstanceId (string) --

        The 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 return false , and instances without a connected agent cannot accept placement requests.

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

      • attributes (list) --

        The attributes set for the container instance by the Amazon ECS container agent at instance registration.

        • (dict) --

          The attributes applicable to a container instance when it is registered.

          • name (string) --

            The name of the container instance attribute.

          • value (string) --

            The value of the container instance attribute.