Amazon EC2 Container Service

2015/12/21 - Amazon EC2 Container Service - 4 updated api methods

CreateService (updated) Link ¶
Changes (request, response)
Request
{'deploymentConfiguration': {'maximumPercent': 'integer',
                             'minimumHealthyPercent': 'integer'}}
Response
{'service': {'deploymentConfiguration': {'maximumPercent': 'integer',
                                         'minimumHealthyPercent': 'integer'}}}

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.

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 list of load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

  • (dict) --

    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'
            },
        ]
    }
}

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 of the cluster that hosts the service.

      • loadBalancers (list) --

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

        • (dict) --

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

DeleteService (updated) Link ¶
Changes (response)
{'service': {'deploymentConfiguration': {'maximumPercent': 'integer',
                                         'minimumHealthyPercent': 'integer'}}}

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'
            },
        ]
    }
}

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 of the cluster that hosts the service.

      • loadBalancers (list) --

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

        • (dict) --

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

DescribeServices (updated) Link ¶
Changes (response)
{'services': {'deploymentConfiguration': {'maximumPercent': 'integer',
                                          'minimumHealthyPercent': 'integer'}}}

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'
                },
            ]
        },
    ],
    '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 of the cluster that hosts the service.

        • loadBalancers (list) --

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

          • (dict) --

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

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

UpdateService (updated) Link ¶
Changes (request, response)
Request
{'deploymentConfiguration': {'maximumPercent': 'integer',
                             'minimumHealthyPercent': 'integer'}}
Response
{'service': {'deploymentConfiguration': {'maximumPercent': 'integer',
                                         'minimumHealthyPercent': 'integer'}}}

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'
            },
        ]
    }
}

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 of the cluster that hosts the service.

      • loadBalancers (list) --

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

        • (dict) --

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