Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ecs ]

describe-services

Description

Describes the specified services running in your cluster.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  describe-services
[--cluster <value>]
--services <value>
[--include <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--cluster (string)

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

--services (list)

A list of services to describe. You may specify up to 10 services to describe in a single operation.

Syntax:

"string" "string" ...

--include (list)

Specifies whether you want to see the resource tags for the service. If TAGS is specified, the tags are included in the response. If this field is omitted, tags are not included in the response.

Syntax:

"string" "string" ...

Where valid values are:
  TAGS

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To describe a service

This example command provides descriptive information about the my-http-service.

Command:

aws ecs describe-services --service my-http-service

Output:

{
    "services": [
        {
            "status": "ACTIVE",
            "taskDefinition": "arn:aws:ecs:<region>:<aws_account_id>:task-definition/amazon-ecs-sample:1",
            "pendingCount": 0,
            "loadBalancers": [],
            "desiredCount": 10,
            "createdAt": 1466801808.595,
            "serviceName": "my-http-service",
            "clusterArn": "arn:aws:ecs:<region>:<aws_account_id>:cluster/default",
            "serviceArn": "arn:aws:ecs:<region>:<aws_account_id>:service/my-http-service",
            "deployments": [
                {
                    "status": "PRIMARY",
                    "pendingCount": 0,
                    "createdAt": 1466801808.595,
                    "desiredCount": 10,
                    "taskDefinition": "arn:aws:ecs:<region>:<aws_account_id>:task-definition/amazon-ecs-sample:1",
                    "updatedAt": 1428326312.703,
                    "id": "ecs-svc/9223370608528463088",
                    "runningCount": 10
                }
            ],
            "events": [
                {
                    "message": "(service my-http-service) has reached a steady state.",
                    "id": "97c8a8e0-16a5-4d30-80bd-9e5413f8951b",
                    "createdAt": 1466801812.435
                }
            ],
            "runningCount": 10
        }
    ],
    "failures": []
}

Output

services -> (list)

The list of services described.

(structure)

Details on a service within a cluster

serviceArn -> (string)

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

Services with tasks that use the awsvpc network mode (for example, those with the Fargate launch type) only support Application Load Balancers and Network Load Balancers. Classic Load Balancers are not supported. Also, when you create any target groups for these services, you must choose ip as the target type, not instance . Tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.

(structure)

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

If the service is using the ECS deployment controller, you are limited to one load balancer or target group.

If the service is using the CODE_DEPLOY deployment controller, the service is required to use either an Application Load Balancer or Network Load Balancer. When you are creating an AWS CodeDeploy deployment group, you specify two target groups (referred to as a targetGroupPair ). Each target group binds to a separate task set in the deployment. The load balancer can also have up to two listeners, a required listener for production traffic and an optional listener that allows you to test new revisions of the service before routing production traffic to it.

Services with tasks that use the awsvpc network mode (for example, those with the Fargate launch type) only support Application Load Balancers and Network Load Balancers. Classic Load Balancers are not supported. Also, when you create any target groups for these services, you must choose ip as the target type, not instance . Tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.

targetGroupArn -> (string)

The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group or groups associated with a service. For services using the ECS deployment controller, you are limited to one target group. For services using the CODE_DEPLOY deployment controller, you are required to define two target groups for the load balancer.

Warning

If your service's task definition uses the awsvpc network mode (which is required for the Fargate launch type), you must choose ip as the target type, not instance , because tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.

loadBalancerName -> (string)

The name of a 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.

serviceRegistries -> (list)

(structure)

Details of the service registry.

registryArn -> (string)

The Amazon Resource Name (ARN) of the service registry. The currently supported service registry is Amazon Route 53 Auto Naming. For more information, see Service .

port -> (integer)

The port value used if your service discovery service specified an SRV record. This field may be used if both the awsvpc network mode and SRV records are used.

containerName -> (string)

The container name value, already specified in the task definition, to be used for your service discovery service. If the task definition that your service task specifies uses the bridge or host network mode, you must specify a containerName and containerPort combination from the task definition. If the task definition that your service task specifies uses the awsvpc network mode and a type SRV DNS record is used, you must specify either a containerName and containerPort combination or a port value, but not both.

containerPort -> (integer)

The port value, already specified in the task definition, to be used for your service discovery service. If the task definition your service task specifies uses the bridge or host network mode, you must specify a containerName and containerPort combination from the task definition. If the task definition your service task specifies uses the awsvpc network mode and a type SRV DNS record is used, you must specify either a containerName and containerPort combination or a port value, but not both.

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.

launchType -> (string)

The launch type on which your service is running. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide .

platformVersion -> (string)

The platform version on which your tasks in the service are running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide .

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 -> (structure)

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

maximumPercent -> (integer)

If a service is using the rolling update (ECS ) deployment type, the maximum percent parameter represents an upper limit on the number of tasks in a service that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desired number of tasks (rounded down to the nearest integer), and while any container instances are in the DRAINING state if the service contains tasks using the EC2 launch type. This parameter enables you to define the deployment batch size. For example, if your service has a desired number of four tasks and a maximum percent value of 200%, the scheduler may start four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). The default value for maximum percent is 200%.

If a service is using the blue/green (CODE_DEPLOY ) deployment type and tasks that use the EC2 launch type, the maximum percent value is set to the default value and is used to define the upper limit on the number of the tasks in the service that remain in the RUNNING state while the container instances are in the DRAINING state. If the tasks in the service use the Fargate launch type, the maximum percent value is not used, although it is returned when describing your service.

minimumHealthyPercent -> (integer)

If a service is using the rolling update (ECS ) deployment type, the minimum healthy percent represents a lower limit on the number of tasks in a service that must remain in the RUNNING state during a deployment, as a percentage of the desired number of tasks (rounded up to the nearest integer), and while any container instances are in the DRAINING state if the service contains tasks using the EC2 launch type. This parameter enables you to deploy without using additional cluster capacity. For example, if your service has a desired number of four tasks and a minimum healthy percent of 50%, the scheduler may stop two existing tasks to free up cluster capacity 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 they are reported as healthy by the load balancer. The default value for minimum healthy percent is 100%.

If a service is using the blue/green (CODE_DEPLOY ) deployment type and tasks that use the EC2 launch type, the minimum healthy percent value is set to the default value and is used to define the lower limit on the number of the tasks in the service that remain in the RUNNING state while the container instances are in the DRAINING state. If the tasks in the service use the Fargate launch type, the minimum healthy percent value is not used, although it is returned when describing your service.

taskSets -> (list)

Information about a set of Amazon ECS tasks in an AWS CodeDeploy deployment. An Amazon ECS task set includes details such as the desired number of tasks, how many tasks are running, and whether the task set serves production traffic.

(structure)

Information about a set of Amazon ECS tasks in an AWS CodeDeploy deployment. An Amazon ECS task set includes details such as the desired number of tasks, how many tasks are running, and whether the task set serves production traffic.

id -> (string)

The ID of the task set.

taskSetArn -> (string)

The Amazon Resource Name (ARN) of the task set.

startedBy -> (string)

The tag specified when a task set is started. If the task is started by an AWS CodeDeploy deployment, then the startedBy parameter is CODE_DEPLOY .

externalId -> (string)

The deployment ID of the AWS CodeDeploy deployment.

status -> (string)

The status of the task set. The following describes each state:

PRIMARY

The task set is serving production traffic.

ACTIVE

The task set is not serving production traffic.

DRAINING

The tasks in the task set are being stopped and their corresponding targets are being deregistered from their target group.

taskDefinition -> (string)

The task definition the task set is using.

computedDesiredCount -> (integer)

The computed desired count for the task set. This is calculated by multiplying the service's desiredCount by the task set's scale percentage.

pendingCount -> (integer)

The number of tasks in the task set that are in the PENDING status during a deployment. A task in the PENDING state is preparing to enter the RUNNING state. A task set enters the PENDING status when it launches for the first time, or when it is restarted after being in the STOPPED state.

runningCount -> (integer)

The number of tasks in the task set that are in the RUNNING status during a deployment. A task in the RUNNING state is running and ready for use.

createdAt -> (timestamp)

The Unix timestamp for when the task set was created.

updatedAt -> (timestamp)

The Unix timestamp for when the task set was last updated.

launchType -> (string)

The launch type the tasks in the task set are using. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide .

platformVersion -> (string)

The platform version on which the tasks in the task set are running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide .

networkConfiguration -> (structure)

The network configuration for the task set.

awsvpcConfiguration -> (structure)

The VPC subnets and security groups associated with a task.

Note

All specified subnets and security groups must be from the same VPC.

subnets -> (list)

The subnets associated with the task or service. There is a limit of 16 subnets that can be specified per AwsVpcConfiguration .

Note

All specified subnets must be from the same VPC.

(string)

securityGroups -> (list)

The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. There is a limit of 5 security groups that can be specified per AwsVpcConfiguration .

Note

All specified security groups must be from the same VPC.

(string)

assignPublicIp -> (string)

Whether the task's elastic network interface receives a public IP address. The default value is DISABLED .

loadBalancers -> (list)

Details on a load balancer that is used with a task set.

(structure)

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

If the service is using the ECS deployment controller, you are limited to one load balancer or target group.

If the service is using the CODE_DEPLOY deployment controller, the service is required to use either an Application Load Balancer or Network Load Balancer. When you are creating an AWS CodeDeploy deployment group, you specify two target groups (referred to as a targetGroupPair ). Each target group binds to a separate task set in the deployment. The load balancer can also have up to two listeners, a required listener for production traffic and an optional listener that allows you to test new revisions of the service before routing production traffic to it.

Services with tasks that use the awsvpc network mode (for example, those with the Fargate launch type) only support Application Load Balancers and Network Load Balancers. Classic Load Balancers are not supported. Also, when you create any target groups for these services, you must choose ip as the target type, not instance . Tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.

targetGroupArn -> (string)

The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group or groups associated with a service. For services using the ECS deployment controller, you are limited to one target group. For services using the CODE_DEPLOY deployment controller, you are required to define two target groups for the load balancer.

Warning

If your service's task definition uses the awsvpc network mode (which is required for the Fargate launch type), you must choose ip as the target type, not instance , because tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.

loadBalancerName -> (string)

The name of a 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.

scale -> (structure)

A floating-point percentage of the desired number of tasks to place and keep running in the service.

value -> (double)

The value, specified as a percent total of a service's desiredCount , to scale the task set.

unit -> (string)

The unit of measure for the scale value.

stabilityStatus -> (string)

The stability status, which indicates whether the task set has reached a steady state. If the following conditions are met, the task set will be in STEADY_STATE :

  • The task runningCount is equal to the computedDesiredCount .
  • The pendingCount is 0 .
  • There are no tasks running on container instances in the DRAINING status.
  • All tasks are reporting a healthy status from the load balancers, service discovery, and container health checks.

If any of those conditions are not met, the stability status returns STABILIZING .

stabilityStatusAt -> (timestamp)

The Unix timestamp for when the task set stability status was retrieved.

deployments -> (list)

The current state of deployments for the service.

(structure)

The details of an Amazon ECS service deployment. This is used when a service uses the CODE_DEPLOY deployment controller type.

id -> (string)

The ID of the deployment.

status -> (string)

The status of the deployment. The following describes each state:

PRIMARY

The most recent deployment of a service.

ACTIVE

A service deployment that still has running tasks, but are in the process of being replaced with a new PRIMARY deployment.

INACTIVE

A deployment that has been completely replaced.

taskDefinition -> (string)

The most recent task definition that was specified for the tasks in 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 -> (timestamp)

The Unix timestamp for when the service deployment was created.

updatedAt -> (timestamp)

The Unix timestamp for when the service deployment was last updated.

launchType -> (string)

The launch type the tasks in the service are using. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide .

platformVersion -> (string)

The platform version on which your tasks in the service are running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide .

networkConfiguration -> (structure)

The VPC subnet and security group configuration for tasks that receive their own elastic network interface by using the awsvpc networking mode.

awsvpcConfiguration -> (structure)

The VPC subnets and security groups associated with a task.

Note

All specified subnets and security groups must be from the same VPC.

subnets -> (list)

The subnets associated with the task or service. There is a limit of 16 subnets that can be specified per AwsVpcConfiguration .

Note

All specified subnets must be from the same VPC.

(string)

securityGroups -> (list)

The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. There is a limit of 5 security groups that can be specified per AwsVpcConfiguration .

Note

All specified security groups must be from the same VPC.

(string)

assignPublicIp -> (string)

Whether the task's elastic network interface receives a public IP address. The default value is DISABLED .

roleArn -> (string)

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

(structure)

Details on an event associated with a service.

id -> (string)

The ID string of the event.

createdAt -> (timestamp)

The Unix timestamp for when the event was triggered.

message -> (string)

The event message.

createdAt -> (timestamp)

The Unix timestamp for when the service was created.

placementConstraints -> (list)

The placement constraints for the tasks in the service.

(structure)

An object representing a constraint on task placement. For more information, see Task Placement Constraints in the Amazon Elastic Container Service Developer Guide .

type -> (string)

The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict the selection to a group of valid candidates. The value distinctInstance is not supported in task definitions.

expression -> (string)

A cluster query language expression to apply to the constraint. You cannot specify an expression if the constraint type is distinctInstance . For more information, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide .

placementStrategy -> (list)

The placement strategy that determines how tasks for the service are placed.

(structure)

The task placement strategy for a task or service. For more information, see Task Placement Strategies in the Amazon Elastic Container Service Developer Guide .

type -> (string)

The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).

field -> (string)

The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host , which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone . For the binpack placement strategy, valid values are cpu and memory . For the random placement strategy, this field is not used.

networkConfiguration -> (structure)

The VPC subnet and security group configuration for tasks that receive their own elastic network interface by using the awsvpc networking mode.

awsvpcConfiguration -> (structure)

The VPC subnets and security groups associated with a task.

Note

All specified subnets and security groups must be from the same VPC.

subnets -> (list)

The subnets associated with the task or service. There is a limit of 16 subnets that can be specified per AwsVpcConfiguration .

Note

All specified subnets must be from the same VPC.

(string)

securityGroups -> (list)

The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. There is a limit of 5 security groups that can be specified per AwsVpcConfiguration .

Note

All specified security groups must be from the same VPC.

(string)

assignPublicIp -> (string)

Whether the task's elastic network interface receives a public IP address. The default value is DISABLED .

healthCheckGracePeriodSeconds -> (integer)

The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.

schedulingStrategy -> (string)

The scheduling strategy to use for the service. For more information, see Services .

There are two service scheduler strategies available:

  • REPLICA -The replica scheduling strategy places and maintains the desired number of tasks across your cluster. By default, the service scheduler spreads tasks across Availability Zones. You can use task placement strategies and constraints to customize task placement decisions.
  • DAEMON -The daemon scheduling strategy deploys exactly one task on each container instance in your cluster. When you are using this strategy, do not specify a desired number of tasks or any task placement strategies.

Note

Fargate tasks do not support the DAEMON scheduling strategy.

deploymentController -> (structure)

The deployment controller type the service is using.

type -> (string)

The deployment controller type to use.

There are two deployment controller types available:

ECS

The rolling update (ECS ) deployment type involves replacing the current running version of the container with the latest version. The number of containers Amazon ECS adds or removes from the service during a rolling update is controlled by adjusting the minimum and maximum number of healthy tasks allowed during a service deployment, as specified in the DeploymentConfiguration .

CODE_DEPLOY

The blue/green (CODE_DEPLOY ) deployment type uses the blue/green deployment model powered by AWS CodeDeploy, which allows you to verify a new deployment of a service before sending production traffic to it. For more information, see Amazon ECS Deployment Types in the Amazon Elastic Container Service Developer Guide .

tags -> (list)

The metadata that you apply to the service to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

(structure)

The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

key -> (string)

One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

value -> (string)

The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

createdBy -> (string)

The principal that created the service.

enableECSManagedTags -> (boolean)

Specifies whether to enable Amazon ECS managed tags for the tasks in the service. For more information, see Tagging Your Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide .

propagateTags -> (string)

Specifies whether to propagate the tags from the task definition or the service to the task. If no value is specified, the tags are not propagated.

failures -> (list)

Any failures associated with the call.

(structure)

A failed resource.

arn -> (string)

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

reason -> (string)

The reason for the failure.