Amazon EC2 Container Service

2016/05/05 - Amazon EC2 Container Service - 7 updated api methods

CreateService (updated) Link ¶
Changes (response)
{'service': {'createdAt': 'timestamp'}}

Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount , Amazon ECS spawns another instantiation of the task in the specified cluster. To update an existing service, see UpdateService.

In addition to maintaining the desired count of tasks in your service, you can optionally run your service behind a load balancer. The load balancer distributes traffic across the tasks that are associated with the service.

You can optionally specify a deployment configuration for your service. During a deployment (which is triggered by changing the task definition of a service with an UpdateService operation), the service scheduler uses the minimumHealthyPercent and maximumPercent parameters to determine the deployment strategy.

If the minimumHealthyPercent is below 100%, the scheduler can ignore the desiredCount temporarily during a deployment. For example, if your service has a desiredCount of four tasks, a minimumHealthyPercent of 50% allows the scheduler to stop two existing tasks before starting two new tasks. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state; tasks for services that do use a load balancer are considered healthy if they are in the RUNNING state and the container instance it is hosted on is reported as healthy by the load balancer. The default value for minimumHealthyPercent is 50% in the console and 100% for the AWS CLI, the AWS SDKs, and the APIs.

The maximumPercent parameter represents an upper limit on the number of running tasks during a deployment, which enables you to define the deployment batch size. For example, if your service has a desiredCount of four tasks, a maximumPercent value of 200% starts four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). The default value for maximumPercent is 200%.

When the service scheduler launches new tasks, it attempts to balance them across the Availability Zones in your cluster with the following logic:

  • Determine which of the container instances in your cluster can support your service's task definition (for example, they have the required CPU, memory, ports, and container instance attributes).

  • Sort the valid container instances by the fewest number of running tasks for this service in the same Availability Zone as the instance. For example, if zone A has one running service task and zones B and C each have zero, valid container instances in either zone B or C are considered optimal for placement.

  • Place the new service task on a valid container instance in an optimal Availability Zone (based on the previous steps), favoring container instances with the fewest number of running tasks for this service.

Request Syntax

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

string

param cluster

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

type serviceName

string

param serviceName

[REQUIRED]

The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.

type taskDefinition

string

param taskDefinition

[REQUIRED]

The family and revision ( family:revision ) or full Amazon Resource Name (ARN) of the task definition to run in your service. If a revision is not specified, the latest ACTIVE revision is used.

type loadBalancers

list

param loadBalancers

A load balancer object representing the load balancer to use with your service.

For Elastic Load Balancing standard load balancers, this object must contain the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance is registered with the load balancer specified here.

For Elastic Load Balancing application load balancers, this object must contain the load balancer target group ARN, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance and port combination is registered as a target in the target group specified here.

  • (dict) --

    Details on a load balancer that is used with a service.

    • loadBalancerName (string) --

      The name of the load balancer.

    • containerName (string) --

      The name of the container (as it appears in a container definition) to associate with the load balancer.

    • containerPort (integer) --

      The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.

type desiredCount

integer

param desiredCount

[REQUIRED]

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

type clientToken

string

param clientToken

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

type role

string

param role

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

type deploymentConfiguration

dict

param deploymentConfiguration

Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

  • maximumPercent (integer) --

    The upper limit (as a percentage of the service's desiredCount ) of the number of running tasks that can be running in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by the maximumPercent /100, rounded down to the nearest integer value.

  • minimumHealthyPercent (integer) --

    The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain running and healthy in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by the minimumHealthyPercent /100, rounded up to the nearest integer value.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • service (dict) --

      The full description of your service following the create call.

      • serviceArn (string) --

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

      • serviceName (string) --

        The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.

      • clusterArn (string) --

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

      • loadBalancers (list) --

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

        • (dict) --

          Details on a load balancer that is used with a service.

          • loadBalancerName (string) --

            The name of the load balancer.

          • containerName (string) --

            The name of the container (as it appears in a container definition) to associate with the load balancer.

          • containerPort (integer) --

            The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.

      • status (string) --

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

      • desiredCount (integer) --

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

      • runningCount (integer) --

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

      • pendingCount (integer) --

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

      • taskDefinition (string) --

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

      • deploymentConfiguration (dict) --

        Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

        • maximumPercent (integer) --

          The upper limit (as a percentage of the service's desiredCount ) of the number of running tasks that can be running in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by the maximumPercent /100, rounded down to the nearest integer value.

        • minimumHealthyPercent (integer) --

          The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain running and healthy in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by the minimumHealthyPercent /100, rounded up to the nearest integer value.

      • deployments (list) --

        The current state of deployments for the service.

        • (dict) --

          The details of an Amazon ECS service deployment.

          • id (string) --

            The ID of the deployment.

          • status (string) --

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

          • taskDefinition (string) --

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

          • desiredCount (integer) --

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

          • pendingCount (integer) --

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

          • runningCount (integer) --

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

          • createdAt (datetime) --

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

          • updatedAt (datetime) --

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

      • roleArn (string) --

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

      • events (list) --

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

        • (dict) --

          Details on an event associated with a service.

          • id (string) --

            The ID string of the event.

          • createdAt (datetime) --

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

          • message (string) --

            The event message.

      • createdAt (datetime) --

DeleteService (updated) Link ¶
Changes (response)
{'service': {'createdAt': 'timestamp'}}

Deletes a specified service within a cluster. You can delete a service if you have no running tasks in it and the desired task count is zero. If the service is actively maintaining tasks, you cannot delete it, and you must update the service to a desired task count of zero. For more information, see UpdateService.

Note

When you delete a service, if there are still running tasks that require cleanup, the service status moves from ACTIVE to DRAINING , and the service is no longer visible in the console or in ListServices API operations. After the tasks have stopped, then the service status moves from DRAINING to INACTIVE . Services in the DRAINING or INACTIVE status can still be viewed with DescribeServices API operations; however, in the future, INACTIVE services may be cleaned up and purged from Amazon ECS record keeping, and DescribeServices API operations on those services will return a ServiceNotFoundException error.

Request Syntax

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

string

param cluster

The name of the cluster that hosts the service to delete. If you do not specify a cluster, the default cluster is assumed.

type service

string

param service

[REQUIRED]

The name of the service to delete.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • service (dict) --

      The full description of the deleted service.

      • serviceArn (string) --

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

      • serviceName (string) --

        The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.

      • clusterArn (string) --

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

      • loadBalancers (list) --

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

        • (dict) --

          Details on a load balancer that is used with a service.

          • loadBalancerName (string) --

            The name of the load balancer.

          • containerName (string) --

            The name of the container (as it appears in a container definition) to associate with the load balancer.

          • containerPort (integer) --

            The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.

      • status (string) --

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

      • desiredCount (integer) --

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

      • runningCount (integer) --

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

      • pendingCount (integer) --

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

      • taskDefinition (string) --

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

      • deploymentConfiguration (dict) --

        Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

        • maximumPercent (integer) --

          The upper limit (as a percentage of the service's desiredCount ) of the number of running tasks that can be running in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by the maximumPercent /100, rounded down to the nearest integer value.

        • minimumHealthyPercent (integer) --

          The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain running and healthy in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by the minimumHealthyPercent /100, rounded up to the nearest integer value.

      • deployments (list) --

        The current state of deployments for the service.

        • (dict) --

          The details of an Amazon ECS service deployment.

          • id (string) --

            The ID of the deployment.

          • status (string) --

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

          • taskDefinition (string) --

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

          • desiredCount (integer) --

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

          • pendingCount (integer) --

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

          • runningCount (integer) --

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

          • createdAt (datetime) --

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

          • updatedAt (datetime) --

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

      • roleArn (string) --

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

      • events (list) --

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

        • (dict) --

          Details on an event associated with a service.

          • id (string) --

            The ID string of the event.

          • createdAt (datetime) --

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

          • message (string) --

            The event message.

      • createdAt (datetime) --

DeregisterTaskDefinition (updated) Link ¶
Changes (response)
{'taskDefinition': {'containerDefinitions': {'logConfiguration': {'logDriver': {'awslogs'}}}}}

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'|'awslogs',
                    '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 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.

            • Images in official repositories on Docker Hub use a single name (for example, ubuntu or mongo ).

            • Images in other repositories on Docker Hub are qualified with an organization name (for example, amazon/amazon-ecs-agent ).

            • Images in other online repositories are qualified further by a domain name (for example, quay.io/assemblyline/ubuntu ).

          • 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 to reserve for the container. You must specify a non-zero integer for this parameter; the Docker daemon reserves a minimum of 4 MiB of memory for a container, so you should not specify fewer than 4 MiB of memory for your containers. 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.

            Note

            After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the Network Bindings section of a container description of a selected task in the Amazon ECS console, or the networkBindings section DescribeTasks responses.

            • (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 ). Port mappings that are automatically assigned in this way do not count toward the 50 reserved ports limit of a container instance.

              • 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 the 50 reserved ports 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 , and that container fails or stops for any reason, all other containers that are part of the task are stopped. 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.

            All tasks must have at least one essential container. If you have an application that is composed of multiple containers, you should group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon EC2 Container Service Developer Guide .

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

            Warning

            We do not recommend using plain text environment variables for sensitive information, such as credential data.

            • (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. By default, containers use the same logging driver that the Docker daemon uses; however the container may use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation.

            Note

            Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the LogConfiguration data type). Currently unsupported log drivers may be available in future releases of the Amazon ECS container agent.

            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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This name is referenced in the sourceVolume parameter of container definition mountPoints .

          • host (dict) --

            The contents of the host parameter determine whether your data volume persists on the host container instance and where it is stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume, but the data is not guaranteed to persist after the containers associated with it stop running.

            • 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. If the host parameter contains a sourcePath file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the sourcePath value does not exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported.

      • 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 (at this time, the value here is Null , but this could change in future revisions for expandability).

DescribeServices (updated) Link ¶
Changes (response)
{'services': {'createdAt': 'timestamp'}}

Describes the specified services running in your cluster.

Request Syntax

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

string

param cluster

The name of the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed.

type services

list

param services

[REQUIRED]

A list of services to describe.

  • (string) --

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • services (list) --

      The list of services described.

      • (dict) --

        Details on a service within a cluster

        • serviceArn (string) --

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

        • serviceName (string) --

          The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.

        • clusterArn (string) --

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

        • loadBalancers (list) --

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

          • (dict) --

            Details on a load balancer that is used with a service.

            • loadBalancerName (string) --

              The name of the load balancer.

            • containerName (string) --

              The name of the container (as it appears in a container definition) to associate with the load balancer.

            • containerPort (integer) --

              The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.

        • status (string) --

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

        • desiredCount (integer) --

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

        • runningCount (integer) --

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

        • pendingCount (integer) --

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

        • taskDefinition (string) --

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

        • deploymentConfiguration (dict) --

          Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

          • maximumPercent (integer) --

            The upper limit (as a percentage of the service's desiredCount ) of the number of running tasks that can be running in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by the maximumPercent /100, rounded down to the nearest integer value.

          • minimumHealthyPercent (integer) --

            The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain running and healthy in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by the minimumHealthyPercent /100, rounded up to the nearest integer value.

        • deployments (list) --

          The current state of deployments for the service.

          • (dict) --

            The details of an Amazon ECS service deployment.

            • id (string) --

              The ID of the deployment.

            • status (string) --

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

            • taskDefinition (string) --

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

            • desiredCount (integer) --

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

            • pendingCount (integer) --

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

            • runningCount (integer) --

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

            • createdAt (datetime) --

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

            • updatedAt (datetime) --

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

        • roleArn (string) --

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

        • events (list) --

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

          • (dict) --

            Details on an event associated with a service.

            • id (string) --

              The ID string of the event.

            • createdAt (datetime) --

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

            • message (string) --

              The event message.

        • createdAt (datetime) --

    • 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': {'logConfiguration': {'logDriver': {'awslogs'}}}}}

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'|'awslogs',
                    '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 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.

            • Images in official repositories on Docker Hub use a single name (for example, ubuntu or mongo ).

            • Images in other repositories on Docker Hub are qualified with an organization name (for example, amazon/amazon-ecs-agent ).

            • Images in other online repositories are qualified further by a domain name (for example, quay.io/assemblyline/ubuntu ).

          • 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 to reserve for the container. You must specify a non-zero integer for this parameter; the Docker daemon reserves a minimum of 4 MiB of memory for a container, so you should not specify fewer than 4 MiB of memory for your containers. 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.

            Note

            After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the Network Bindings section of a container description of a selected task in the Amazon ECS console, or the networkBindings section DescribeTasks responses.

            • (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 ). Port mappings that are automatically assigned in this way do not count toward the 50 reserved ports limit of a container instance.

              • 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 the 50 reserved ports 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 , and that container fails or stops for any reason, all other containers that are part of the task are stopped. 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.

            All tasks must have at least one essential container. If you have an application that is composed of multiple containers, you should group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon EC2 Container Service Developer Guide .

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

            Warning

            We do not recommend using plain text environment variables for sensitive information, such as credential data.

            • (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. By default, containers use the same logging driver that the Docker daemon uses; however the container may use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation.

            Note

            Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the LogConfiguration data type). Currently unsupported log drivers may be available in future releases of the Amazon ECS container agent.

            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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This name is referenced in the sourceVolume parameter of container definition mountPoints .

          • host (dict) --

            The contents of the host parameter determine whether your data volume persists on the host container instance and where it is stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume, but the data is not guaranteed to persist after the containers associated with it stop running.

            • 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. If the host parameter contains a sourcePath file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the sourcePath value does not exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported.

      • 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 (at this time, the value here is Null , but this could change in future revisions for expandability).

RegisterTaskDefinition (updated) Link ¶
Changes (request, response)
Request
{'containerDefinitions': {'logConfiguration': {'logDriver': {'awslogs'}}}}
Response
{'taskDefinition': {'containerDefinitions': {'logConfiguration': {'logDriver': {'awslogs'}}}}}

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'|'awslogs',
                '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.

      • Images in official repositories on Docker Hub use a single name (for example, ubuntu or mongo ).

      • Images in other repositories on Docker Hub are qualified with an organization name (for example, amazon/amazon-ecs-agent ).

      • Images in other online repositories are qualified further by a domain name (for example, quay.io/assemblyline/ubuntu ).

    • 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 to reserve for the container. You must specify a non-zero integer for this parameter; the Docker daemon reserves a minimum of 4 MiB of memory for a container, so you should not specify fewer than 4 MiB of memory for your containers. 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.

      Note

      After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the Network Bindings section of a container description of a selected task in the Amazon ECS console, or the networkBindings section DescribeTasks responses.

      • (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 ). Port mappings that are automatically assigned in this way do not count toward the 50 reserved ports limit of a container instance.

        • 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 the 50 reserved ports 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 , and that container fails or stops for any reason, all other containers that are part of the task are stopped. 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.

      All tasks must have at least one essential container. If you have an application that is composed of multiple containers, you should group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon EC2 Container Service Developer Guide .

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

      Warning

      We do not recommend using plain text environment variables for sensitive information, such as credential data.

      • (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. By default, containers use the same logging driver that the Docker daemon uses; however the container may use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation.

      Note

      Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the LogConfiguration data type). Currently unsupported log drivers may be available in future releases of the Amazon ECS container agent.

      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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This name is referenced in the sourceVolume parameter of container definition mountPoints .

    • host (dict) --

      The contents of the host parameter determine whether your data volume persists on the host container instance and where it is stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume, but the data is not guaranteed to persist after the containers associated with it stop running.

      • 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. If the host parameter contains a sourcePath file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the sourcePath value does not exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported.

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'|'awslogs',
                    '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 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.

            • Images in official repositories on Docker Hub use a single name (for example, ubuntu or mongo ).

            • Images in other repositories on Docker Hub are qualified with an organization name (for example, amazon/amazon-ecs-agent ).

            • Images in other online repositories are qualified further by a domain name (for example, quay.io/assemblyline/ubuntu ).

          • 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 to reserve for the container. You must specify a non-zero integer for this parameter; the Docker daemon reserves a minimum of 4 MiB of memory for a container, so you should not specify fewer than 4 MiB of memory for your containers. 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.

            Note

            After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the Network Bindings section of a container description of a selected task in the Amazon ECS console, or the networkBindings section DescribeTasks responses.

            • (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 ). Port mappings that are automatically assigned in this way do not count toward the 50 reserved ports limit of a container instance.

              • 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 the 50 reserved ports 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 , and that container fails or stops for any reason, all other containers that are part of the task are stopped. 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.

            All tasks must have at least one essential container. If you have an application that is composed of multiple containers, you should group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon EC2 Container Service Developer Guide .

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

            Warning

            We do not recommend using plain text environment variables for sensitive information, such as credential data.

            • (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. By default, containers use the same logging driver that the Docker daemon uses; however the container may use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation.

            Note

            Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the LogConfiguration data type). Currently unsupported log drivers may be available in future releases of the Amazon ECS container agent.

            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. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. This name is referenced in the sourceVolume parameter of container definition mountPoints .

          • host (dict) --

            The contents of the host parameter determine whether your data volume persists on the host container instance and where it is stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume, but the data is not guaranteed to persist after the containers associated with it stop running.

            • 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. If the host parameter contains a sourcePath file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the sourcePath value does not exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported.

      • 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 (at this time, the value here is Null , but this could change in future revisions for expandability).

UpdateService (updated) Link ¶
Changes (response)
{'service': {'createdAt': 'timestamp'}}

Modifies the desired count, deployment configuration, or task definition used in a service.

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

You can use UpdateService to modify your task definition and deploy a new version of your service.

You can also update the deployment configuration of a service. When a deployment is triggered by updating the task definition of a service, the service scheduler uses the deployment configuration parameters, minimumHealthyPercent and maximumPercent , to determine the deployment strategy.

If the minimumHealthyPercent is below 100%, the scheduler can ignore the desiredCount temporarily during a deployment. For example, if your service has a desiredCount of four tasks, a minimumHealthyPercent of 50% allows the scheduler to stop two existing tasks before starting two new tasks. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state; tasks for services that do use a load balancer are considered healthy if they are in the RUNNING state and the container instance it is hosted on is reported as healthy by the load balancer.

The maximumPercent parameter represents an upper limit on the number of running tasks during a deployment, which enables you to define the deployment batch size. For example, if your service has a desiredCount of four tasks, a maximumPercent value of 200% starts four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available).

When UpdateService stops a task during a deployment, the equivalent of docker stop is issued to the containers running in the task. This results in a SIGTERM and a 30-second timeout, after which SIGKILL is sent and the containers are forcibly stopped. If the container handles the SIGTERM gracefully and exits within 30 seconds from receiving it, no SIGKILL is sent.

When the service scheduler launches new tasks, it attempts to balance them across the Availability Zones in your cluster with the following logic:

  • Determine which of the container instances in your cluster can support your service's task definition (for example, they have the required CPU, memory, ports, and container instance attributes).

  • Sort the valid container instances by the fewest number of running tasks for this service in the same Availability Zone as the instance. For example, if zone A has one running service task and zones B and C each have zero, valid container instances in either zone B or C are considered optimal for placement.

  • Place the new service task on a valid container instance in an optimal Availability Zone (based on the previous steps), favoring container instances with the fewest number of running tasks for this service.

Request Syntax

client.update_service(
    cluster='string',
    service='string',
    desiredCount=123,
    taskDefinition='string',
    deploymentConfiguration={
        'maximumPercent': 123,
        'minimumHealthyPercent': 123
    }
)
type cluster

string

param cluster

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

type service

string

param service

[REQUIRED]

The name of the service to update.

type desiredCount

integer

param desiredCount

The number of instantiations of the task to place and keep running in your service.

type taskDefinition

string

param taskDefinition

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

type deploymentConfiguration

dict

param deploymentConfiguration

Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

  • maximumPercent (integer) --

    The upper limit (as a percentage of the service's desiredCount ) of the number of running tasks that can be running in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by the maximumPercent /100, rounded down to the nearest integer value.

  • minimumHealthyPercent (integer) --

    The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain running and healthy in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by the minimumHealthyPercent /100, rounded up to the nearest integer value.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • service (dict) --

      The full description of your service following the update call.

      • serviceArn (string) --

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

      • serviceName (string) --

        The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.

      • clusterArn (string) --

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

      • loadBalancers (list) --

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

        • (dict) --

          Details on a load balancer that is used with a service.

          • loadBalancerName (string) --

            The name of the load balancer.

          • containerName (string) --

            The name of the container (as it appears in a container definition) to associate with the load balancer.

          • containerPort (integer) --

            The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.

      • status (string) --

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

      • desiredCount (integer) --

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

      • runningCount (integer) --

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

      • pendingCount (integer) --

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

      • taskDefinition (string) --

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

      • deploymentConfiguration (dict) --

        Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

        • maximumPercent (integer) --

          The upper limit (as a percentage of the service's desiredCount ) of the number of running tasks that can be running in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by the maximumPercent /100, rounded down to the nearest integer value.

        • minimumHealthyPercent (integer) --

          The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain running and healthy in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by the minimumHealthyPercent /100, rounded up to the nearest integer value.

      • deployments (list) --

        The current state of deployments for the service.

        • (dict) --

          The details of an Amazon ECS service deployment.

          • id (string) --

            The ID of the deployment.

          • status (string) --

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

          • taskDefinition (string) --

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

          • desiredCount (integer) --

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

          • pendingCount (integer) --

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

          • runningCount (integer) --

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

          • createdAt (datetime) --

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

          • updatedAt (datetime) --

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

      • roleArn (string) --

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

      • events (list) --

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

        • (dict) --

          Details on an event associated with a service.

          • id (string) --

            The ID string of the event.

          • createdAt (datetime) --

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

          • message (string) --

            The event message.

      • createdAt (datetime) --