(aws-ecs): (Add deregistration delay parameter to FargateService construct)
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Currently, when deploying a service using ECS Fargate without a load balancer, there is a fixed deregistration delay of 5 minutes for replaced tasks (old tasks enter a draining state and remain there for 5 minutes), which is non-configurable unless a load balancer with target groups is used. I am proposing the addition of a `deregistrationDelay` parameter to the **FargateService** construct in AWS CDK, allowing developers to customize this delay when a load balancer is not used.
### Use Case
When deploying a service to ECS Fargate that does not require a load balancer, the deployment process is unnecessarily slowed down by the default 5-minute deregistration delay. For example, when tasks are replaced during a deployment, the old tasks enter a draining state and remain there for 5 minutes, even though the service doesn't need this full delay. This results in a longer deployment time than necessary, impacting deployment pipelines and delaying new service availability. Allowing users to specify a custom deregistration delay would optimize this process.
### Proposed Solution
Introduce a `deregistrationDelay` option to the **FargateService** construct to specify the amount of time, in seconds, to wait before changing the state of a deregistering target from `draining` to `unused`. The range is 0-3600 seconds. The default value is 300 seconds.
### Other Information
[`deregistration_delay.timeout_seconds` used in aws_elasticloadbalancingv2](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.CfnTargetGroup.TargetGroupAttributeProperty.html#key)
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
v2.150.0
### Environment details (OS name and version, etc.)
Mac OS Sequoia
Contributor guide
Research direction
Start at the FargateService construct and inspect how services without load balancers are synthesized, then review its existing tests and option definitions. Done means exposing a deregistrationDelay option with a 0–3600 second range and a 300-second default, applying it only where relevant, and covering the behavior in tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100