Class CfnService
The AWS::ECS::Service resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.
Inherited Members
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnService : CfnResource, IInspectable, IServiceRef, IConstruct, IDependable, IEnvironmentAware, ITaggable
Syntax (vb)
Public Class CfnService Inherits CfnResource Implements IInspectable, IServiceRef, IConstruct, IDependable, IEnvironmentAware, ITaggable
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
ManagedInstancesCapacityProvider miCapacityProvider;
var service = new FargateService(this, "Service", new FargateServiceProps {
Cluster = cluster,
TaskDefinition = taskDefinition,
CapacityProviderStrategies = new [] { new CapacityProviderStrategy {
CapacityProvider = miCapacityProvider.CapacityProviderName,
Weight = 1
} }
});
// Escape hatch: Force launchType at the CloudFormation level to prevent service replacement
var cfnService = (CfnService)service.Node.DefaultChild;
cfnService.LaunchType = "FARGATE";
Synopsis
Constructors
| CfnService(Construct, string, ICfnServiceProps?) | Create a new |
Properties
| AttrName | The name of the Amazon ECS service, such as |
| AttrServiceArn | The ARN that identifies the service. |
| AvailabilityZoneRebalancing | Indicates whether to use Availability Zone rebalancing for the service. |
| CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
| CapacityProviderStrategy | The capacity provider strategy to use for the service. |
| CfnProperties | The |
| Cluster | The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on. |
| DeploymentConfiguration | Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks. |
| DeploymentController | The deployment controller to use for the service. |
| DesiredCount | The number of instantiations of the specified task definition to place and keep running in your service. |
| EnableEcsManagedTags | Specifies whether to turn on Amazon ECS managed tags for the tasks within the service. |
| EnableExecuteCommand | Determines whether the execute command functionality is turned on for the service. |
| ForceNewDeployment | Determines whether to force a new deployment of the service. |
| HealthCheckGracePeriodSeconds | The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started. |
| LaunchType | The launch type on which to run your service. |
| LoadBalancers | A list of load balancer objects to associate with the service. |
| NetworkConfiguration | The network configuration for the service. |
| PlacementConstraints | An array of placement constraint objects to use for tasks in your service. |
| PlacementStrategies | The placement strategy objects to use for tasks in your service. |
| PlatformVersion | The platform version that your tasks in the service are running on. |
| PropagateTags | Specifies whether to propagate the tags from the task definition to the task. |
| Role | The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. |
| SchedulingStrategy | The scheduling strategy to use for the service. |
| ServiceConnectConfiguration | The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace. |
| ServiceName | The name of your service. |
| ServiceRef | A reference to a Service resource. |
| ServiceRegistries | The details of the service discovery registry to associate with this service. |
| Tags | Tag Manager which manages the tags for this resource. |
| TagsRaw | The metadata that you apply to the service to help you categorize and organize them. |
| TaskDefinition | The |
| VolumeConfigurations | The configuration for a volume specified in the task definition as a volume that is configured at launch time. |
| VpcLatticeConfigurations | The VPC Lattice configuration for the service being created. |
Methods
| ArnForService(IServiceRef) | The |
| Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
| IsCfnService(object) | Checks whether the given object is a CfnService. |
| RenderProperties(IDictionary<string, object>) | The |
Constructors
CfnService(Construct, string, ICfnServiceProps?)
Create a new AWS::ECS::Service.
public CfnService(Construct scope, string id, ICfnServiceProps? props = null)
Parameters
- scope Construct
Scope in which this resource is defined.
- id string
Construct identifier for this resource (unique in its scope).
- props ICfnServiceProps
Resource properties.
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
Properties
AttrName
The name of the Amazon ECS service, such as sample-webapp .
public virtual string AttrName { get; }
Property Value
Remarks
CloudformationAttribute: Name
AttrServiceArn
The ARN that identifies the service.
public virtual string AttrServiceArn { get; }
Property Value
Remarks
For more information about the ARN format, see Amazon Resource Name (ARN) in the Amazon ECS Developer Guide .
CloudformationAttribute: ServiceArn
AvailabilityZoneRebalancing
Indicates whether to use Availability Zone rebalancing for the service.
public virtual string? AvailabilityZoneRebalancing { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
CapacityProviderStrategy
The capacity provider strategy to use for the service.
public virtual object? CapacityProviderStrategy { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnService.ICapacityProviderStrategyItemProperty)[]
CfnProperties
The AWS::ECS::Service resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
Overrides
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
Cluster
The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on.
public virtual string? Cluster { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
DeploymentConfiguration
Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
public virtual object? DeploymentConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnService.IDeploymentConfigurationProperty
DeploymentController
The deployment controller to use for the service.
public virtual object? DeploymentController { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnService.IDeploymentControllerProperty
DesiredCount
The number of instantiations of the specified task definition to place and keep running in your service.
public virtual double? DesiredCount { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
EnableEcsManagedTags
Specifies whether to turn on Amazon ECS managed tags for the tasks within the service.
public virtual object? EnableEcsManagedTags { get; set; }
Property Value
Remarks
Type union: either bool or IResolvable
EnableExecuteCommand
Determines whether the execute command functionality is turned on for the service.
public virtual object? EnableExecuteCommand { get; set; }
Property Value
Remarks
Type union: either bool or IResolvable
ForceNewDeployment
Determines whether to force a new deployment of the service.
public virtual object? ForceNewDeployment { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnService.IForceNewDeploymentProperty
HealthCheckGracePeriodSeconds
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started.
public virtual double? HealthCheckGracePeriodSeconds { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
LaunchType
The launch type on which to run your service.
public virtual string? LaunchType { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
LoadBalancers
A list of load balancer objects to associate with the service.
public virtual object? LoadBalancers { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnService.ILoadBalancerProperty)[]
NetworkConfiguration
The network configuration for the service.
public virtual object? NetworkConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnService.INetworkConfigurationProperty
PlacementConstraints
An array of placement constraint objects to use for tasks in your service.
public virtual object? PlacementConstraints { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnService.IPlacementConstraintProperty)[]
PlacementStrategies
The placement strategy objects to use for tasks in your service.
public virtual object? PlacementStrategies { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnService.IPlacementStrategyProperty)[]
PlatformVersion
The platform version that your tasks in the service are running on.
public virtual string? PlatformVersion { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
PropagateTags
Specifies whether to propagate the tags from the task definition to the task.
public virtual string? PropagateTags { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
Role
The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf.
public virtual string? Role { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
SchedulingStrategy
The scheduling strategy to use for the service.
public virtual string? SchedulingStrategy { get; set; }
Property Value
Remarks
For more information, see Services .
ServiceConnectConfiguration
The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.
public virtual object? ServiceConnectConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnService.IServiceConnectConfigurationProperty
ServiceName
The name of your service.
public virtual string? ServiceName { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
ServiceRef
A reference to a Service resource.
public virtual IServiceReference ServiceRef { get; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
ServiceRegistries
The details of the service discovery registry to associate with this service.
public virtual object? ServiceRegistries { get; set; }
Property Value
Remarks
For more information, see Service discovery .
Type union: either IResolvable or (either IResolvable or CfnService.IServiceRegistryProperty)[]
Tags
Tag Manager which manages the tags for this resource.
public virtual TagManager Tags { get; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
TagsRaw
The metadata that you apply to the service to help you categorize and organize them.
public virtual ICfnTag[]? TagsRaw { get; set; }
Property Value
ICfnTag[]
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
TaskDefinition
The family and revision ( family:revision ) or full ARN of the task definition to run in your service.
public virtual string? TaskDefinition { get; set; }
Property Value
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
VolumeConfigurations
The configuration for a volume specified in the task definition as a volume that is configured at launch time.
public virtual object? VolumeConfigurations { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnService.IServiceVolumeConfigurationProperty)[]
VpcLatticeConfigurations
The VPC Lattice configuration for the service being created.
public virtual object? VpcLatticeConfigurations { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnService.IVpcLatticeConfigurationProperty)[]
Methods
ArnForService(IServiceRef)
The AWS::ECS::Service resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.
public static string ArnForService(IServiceRef resource)
Parameters
- resource IServiceRef
Returns
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
ManagedInstancesCapacityProvider miCapacityProvider;
var service = new FargateService(this, "Service", new FargateServiceProps {
Cluster = cluster,
TaskDefinition = taskDefinition,
CapacityProviderStrategies = new [] { new CapacityProviderStrategy {
CapacityProvider = miCapacityProvider.CapacityProviderName,
Weight = 1
} }
});
// Escape hatch: Force launchType at the CloudFormation level to prevent service replacement
var cfnService = (CfnService)service.Node.DefaultChild;
cfnService.LaunchType = "FARGATE";
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
IsCfnService(object)
Checks whether the given object is a CfnService.
public static bool IsCfnService(object x)
Parameters
- x object
Returns
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused
RenderProperties(IDictionary<string, object>)
The AWS::ECS::Service resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props IDictionary<string, object>
Returns
Overrides
Remarks
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect <code>ServiceConnectConfiguration</code> property is configured. This is because AWS CloudFormation creates the replacement service first, but each <code>ServiceConnectService</code> must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for <code>CapacityProviderStrategy</code> parameter with the standard practice. For more information, see <a href="https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/">Amazon ECS adds support for updating capacity provider configuration for ECS services</a> . Previously Amazon ECS ignored the <code>CapacityProviderStrategy</code> property if it was set to an empty list for example, <code>[]</code> in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( <code>[]</code> ) for the <code>CapacityProviderStrategy</code> property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
Recommended Actions
If you are currently using CapacityProviderStrategy: [] in your CloudFormation templates, you should take one of the following actions:
If your CloudFormation template had an empty list ([]) for CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , you might encounter the following error:
Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
CloudformationResource: AWS::ECS::Service
ExampleMetadata: infused