(aws-ecs): add a warning when the default value for minimumHealthyPercent
(50%) is used for a service
#31705
Labels
@aws-cdk/aws-ecs
Related to Amazon Elastic Container
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p3
Describe the feature
Add a warning message when
minimumHealthyPercent
isn't set for an ECS service, resulting in the implicit use of CDK's default value of 50%. This warning wouldn't appear ifminimumHealthyPercent
is explicitly set to 50%.Use Case
CDK overrides the default value of 100% used by CloudFormation's
AWS::ECS::Service
and theCreateService
API. This allows the number of running tasks to drop by up to 50% during deployments and Fargate maintenance etc.This is an unsafe default for services which must support a consistent load e.g. handle web traffic via an ALB.
Proposed Solution
Implementation would be similar to the warning when creating an ASG with an explicit desired capacity.
Wording would be along the lines of:
Other Information
#14277 proposed changing the default value to 50%. This is a breaking change (e.g. it can cause stuck deployments) so I believe a warning is more practical. I also considered implementing this as a cdk-nag rule, but I believe a warning in "mainstream CDK" is warranted as this is a quirk of CDK itself.
I wasn't able to find any context for why CDK chose to override CloudFormation's default value. The ECS Developer Guide says 50% should be used to speed up deployments for services which are "idle for some time and don't have a high utilization rate." (source), but 100% is recommended for stateless workloads:
I'm happy to open a PR but just wanted to get thoughts on this before putting pen to paper :)
Acknowledgements
CDK version used
Latest
Environment details (OS name and version, etc.)
N/A
The text was updated successfully, but these errors were encountered: