CLI: speed up ECS hotswapping
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Right now, hotswapping a CDK app that uses ECS takes around 70 seconds.
While that's significantly faster than a regular CloudFormation deployment, which takes around 8 minutes, it would be awesome to speed this up even further - maybe closer to Lambda hotswapping times, which usually take sub-10 seconds.
### Use Case
Any CDK app that uses ECS.
### Proposed Solution
There are a few potential things we can try to speed up the current setup:
1. Call the [ECS `StopTask` API](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_StopTask.html) for the Tasks using the previous Task Definition Revision (after we've triggered the deployment of the service by calling the `UpdateService` API). This should cut down the time we have to wait for ECS to wind these Tasks down.
2. Call the [ECS `RunTask` API](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html) directly, instead of going through a deployment with the `UpdateService` API.
Since nr 2 on the list will probably involve much more complicated changes to the current hotswapping setup than nr 1, I would recommend starting with the first point from the above list.
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
1.154.0
### Environment details (OS name and version, etc.)
all of them
Contributor guide
Research direction
Start by locating the CLI's ECS hotswapping entry point and tracing the current UpdateService flow. Compare the proposed StopTask and RunTask approaches with the ECS API behavior and existing hotswap sequence. Done means ECS hotswapping completes faster without breaking deployments; add or update tests for the changed flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100