AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Update-ECSService-Cluster <String>-AwsvpcConfiguration_AssignPublicIp <AssignPublicIp>-CapacityProviderStrategy <CapacityProviderStrategyItem[]>-DesiredCount <Int32>-DeploymentCircuitBreaker_Enable <Boolean>-EnableECSManagedTag <Boolean>-EnableExecuteCommand <Boolean>-ForceNewDeployment <Boolean>-HealthCheckGracePeriodSecond <Int32>-LoadBalancer <LoadBalancer[]>-DeploymentConfiguration_MaximumPercent <Int32>-DeploymentConfiguration_MinimumHealthyPercent <Int32>-PlacementConstraint <PlacementConstraint[]>-PlacementStrategy <PlacementStrategy[]>-PlatformVersion <String>-PropagateTag <PropagateTags>-DeploymentCircuitBreaker_Rollback <Boolean>-AwsvpcConfiguration_SecurityGroup <String[]>-Service <String>-ServiceRegistry <ServiceRegistry[]>-AwsvpcConfiguration_Subnet <String[]>-TaskDefinition <String>-Select <String>-PassThru <SwitchParameter>-Force <SwitchParameter>
ECS
) you can update the desired count, deployment configuration, network configuration, load balancers, service registries, enable ECS managed tags option, propagate tags option, task placement constraints and strategies, and task definition. When you update any of these parameters, Amazon ECS starts new tasks with the new configuration.
For services using the blue/green (CODE_DEPLOY
) deployment controller, only the desired count, deployment configuration, health check grace period, task placement constraints and strategies, enable ECS managed tags option, and propagate tags can be updated using this API. If the network configuration, platform version, task definition, or load balancer need to be updated, create a new CodeDeploy deployment. For more information, see CreateDeployment in the CodeDeploy API Reference.
For services using an external deployment controller, you can update only the desired count, task placement constraints and strategies, health check grace period, enable ECS managed tags option, and propagate tags option, using this API. If the launch type, load balancer, network configuration, platform version, or task definition need to be updated, create a new task set For more information, see CreateTaskSet.
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.
If you have updated the Docker image of your application, you can create a new task definition with that image and deploy it to your service. The service scheduler uses the minimum healthy percent and maximum percent parameters (in the service's deployment configuration) to determine the deployment strategy.
If your updated Docker image uses the same tag as what is in the existing task definition for your service (for example, my_image:latest
), you don't need to create a new revision of your task definition. You can update the service using the forceNewDeployment
option. The new tasks launched by the deployment pull the current image/tag combination from your repository when they start.
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. minimumHealthyPercent
is below 100%, the scheduler can ignore desiredCount
temporarily during a deployment. For example, if desiredCount
is four tasks, a minimum of 50% allows the scheduler to stop two existing tasks before starting two new tasks. Tasks for services that don't use a load balancer are considered healthy if they're in the RUNNING
state. Tasks for services that use a load balancer are considered healthy if they're in the RUNNING
state and are reported as healthy by the load balancer. maximumPercent
parameter represents an upper limit on the number of running tasks during a deployment. You can use it to define the deployment batch size. For example, if desiredCount
is four tasks, a maximum of 200% starts four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). docker stop
is issued to the containers running in the task. This results in a SIGTERM
and a 30-second timeout. After this, 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 determines task placement in your cluster with the following logic. loadBalancers,
serviceRegistries
DISABLED
. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | NetworkConfiguration_AwsvpcConfiguration_AssignPublicIp |
AwsVpcConfiguration
.All specified security groups must be from the same VPC. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | NetworkConfiguration_AwsvpcConfiguration_SecurityGroups |
AwsVpcConfiguration
.All specified subnets must be from the same VPC. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | NetworkConfiguration_AwsvpcConfiguration_Subnets |
base
and weight
to assign to them. A capacity provider must be associated with the cluster to be used in a capacity provider strategy. The PutClusterCapacityProviders API is used to associate a capacity provider with a cluster. Only capacity providers with an ACTIVE
or UPDATING
status can be used.If specifying a capacity provider that uses an Auto Scaling group, the capacity provider must already be created. New capacity providers can be created with the CreateCapacityProvider API operation.To use a Fargate capacity provider, specify either the FARGATE
or FARGATE_SPOT
capacity providers. The Fargate capacity providers are available to all accounts and only need to be associated with a cluster to be used.The PutClusterCapacityProviders API operation is used to update the list of available capacity providers for a cluster after the cluster is created. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | 1 |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | DeploymentConfiguration_DeploymentCircuitBreaker_Enable |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | DeploymentConfiguration_DeploymentCircuitBreaker_Rollback |
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
) or EXTERNAL
deployment types 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. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
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're in the RUNNING
state; tasks for services that do use a load balancer are considered healthy if they're in the RUNNING
state and they're 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
) or EXTERNAL
deployment types 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. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
forceNewDeployment
to true
, so that Amazon ECS starts new tasks with the updated tags. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | EnableECSManagedTags |
true
, this enables execute command functionality on all task containers.If you do not want to override the value that was set when the service was created, you can set this to null
when performing this action. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
my_image:latest
) or to roll Fargate tasks onto a newer platform version. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | HealthCheckGracePeriodSeconds |
CreateDeployment
through CodeDeploy. Note that multiple target groups are not supported for blue/green deployments. For more information see Register multiple target groups with a service in the Amazon Elastic Container Service Developer Guide. For services that use the external deployment controller, you can add, update, or remove load balancers by using CreateTaskSet. Note that multiple target groups are not supported for external deployments. For more information see Register multiple target groups with a service in the Amazon Elastic Container Service Developer Guide. You can remove existing loadBalancers
by passing an empty list. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | LoadBalancers |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | PlacementConstraints |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
LATEST
platform version is used. For more information, see Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
forceNewDeployment
to true
, so that Amazon ECS starts new tasks with the updated tags. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | PropagateTags |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | True |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
serviceRegistries
by passing an empty list. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | ServiceRegistries |
family
and revision
(family:revision
) or full 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. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | AK |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | AWSProfilesLocation, ProfilesLocation |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | StoredCredentials, AWSProfileName |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | RegionToCall |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | SK, SecretAccessKey |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | ST |
Update-ECSService -Service my-http-service -TaskDefinition amazon-ecs-sampleThis example command updates the `my-http-service` service to use the `amazon-ecs-sample` task definition.
Update-ECSService -Service my-http-service -DesiredCount 10This example command updates the desired count of the `my-http-service` service to 10.
AWS Tools for PowerShell: 2.x.y.z