CfnServicePropsMixin Mixin
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.
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect
ServiceConnectConfigurationproperty is configured. This is because AWS CloudFormation creates the replacement service first, but eachServiceConnectServicemust 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 forCapacityProviderStrategyparameter with the standard practice. For more information, see Amazon ECS adds support for updating capacity provider configuration for ECS services . Previously Amazon ECS ignored theCapacityProviderStrategyproperty if it was set to an empty list for example,[]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 ([]) for theCapacityProviderStrategyproperty in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
For services created with a capacity provider strategy after the launch:
If there's a cluster default strategy set, the service will revert to using that default strategy.
If no cluster default strategy exists, you will receive the following error:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
For services created with a capacity provider strategy prior to the launch:
If
CapacityProviderStrategyhadFARGATE_SPOTorFARGATEcapacity providers, the launch type will be updated toFARGATEand the capacity provider will be removed.If the strategy included Auto Scaling group capacity providers, the service will revert to EC2 launch type, and the Auto Scaling group capacity providers will not be used.
Recommended Actions
If you are currently using
CapacityProviderStrategy: []in your CloudFormation templates, you should take one of the following actions:
If you do not intend to update the Capacity Provider Strategy:
Remove the
CapacityProviderStrategyproperty entirely from your CloudFormation templateAlternatively, use
!Ref AWS ::NoValuefor theCapacityProviderStrategyproperty in your templateIf you intend to maintain or update the Capacity Provider Strategy, specify the actual Capacity Provider Strategy for the service in your CloudFormation template.
If your CloudFormation template had an empty list ([]) for
CapacityProviderStrategyprior to the aforementioned launch on June 12, and you are using the same template withCapacityProviderStrategy: [], 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.
Initializer
new CfnServicePropsMixin(props: CfnServiceMixinProps, options?: CfnPropertyMixinOptions)
CfnServicePropsMixin(props: CfnServiceMixinProps, options: typing.Optional[CfnPropertyMixinOptions] = None)
new CfnServicePropsMixin(CfnServiceMixinProps props, CfnPropertyMixinOptions options)
new CfnServicePropsMixin(CfnServiceMixinProps props, CfnPropertyMixinOptions? options = null)
NewCfnServicePropsMixin(Props CfnServiceMixinProps, Options CfnPropertyMixinOptions)
Methods
applyTo(construct: IConstruct): voiddef apply_to(self, construct: IConstruct) -> Nonepublic void applyTo(IConstruct construct)public void ApplyTo(IConstruct construct)func ApplyTo(Construct IConstruct)#isMixin(x: any): boolean@staticmethod def is_mixin(x: Any) -> boolpublic static Boolean isMixin(Object x)public static bool IsMixin(object x)func IsMixin(X interface{}) *boolstatic#1 parameter · returns
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Mixin.
supports(construct: IConstruct): booleandef supports(self, construct: IConstruct) -> boolpublic Boolean supports(IConstruct construct)public bool Supports(IConstruct construct)func Supports(Construct IConstruct) *bool#