Updating ECS TaskDefinition reverts other changes to running service image definition tag (eg due to CodeDeploy)
See original GitHub issue❓ General Issue
The Question
Whenever an update to the TaskDefinitions for an ECS service is required (for example, new environment variables or CPU limits), the service has the indicated instance image re-applied as to what’s in the CDK template, instead of using whatever is already in the ECS’s service task definition.
Ideally, it would just find and re-use the existing service’s running TaskDefinition container image tag, that would have been set by a separate process since the CDK last performed an update (eg via a CodePipeline deployment process).
Environment
- CDK CLI Version: 1.101.0 (build 149f0fc)
- Module Version:
- Node.js Version:
- OS: all
- Language (Version): C#
Other information
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Updating a service using the classic console
You can update an existing service to change some of the service configuration parameters, such as the number of tasks that are maintained...
Read more >update-service — AWS CLI 2.9.9 Command Reference
If your updated Docker image uses the same tag as what is in the existing task definition for your service (for example, my_image:latest...
Read more >Rolling back AWS Elastic Container Service (ECS) Deployments
AWS ECS UI Console First, visit the service page and click Edit service: Change task definition revision number to a previous version. Click...
Read more >Deploy to AWS from GitLab CI/CD
The targeted task definition is updated with the location of the new Docker image, and a new revision is created in ECS as...
Read more >aws_ecs_service | Resources | hashicorp/aws
Provides an ECS service - effectively a task that is expected to run until an ... tasks to use a newer Docker image...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, I actually implemented a working solution in the past few hours.
I’m now using the TagParameterContainerImage solution mentioned in the CDK docs.
The main change was tightly coupling application and infrastructure within the application deployment pipeline as suggested by @skinny85.
For anyone else watching, this info might be useful:
So yes, I’m all good, thanks all. Hopefully this helps you @Plasma? Feel free to ask further questions.
In my opinion, the problem is that you’ve split the deployment between code and infrastructure, and that’s why you’re running into this issue.
Unless you’re willing to dramatically change your setup, and move the CDK deployment also to the Pipeline (which is absolutely what you should do), I don’t think you’ll ever solve this problem.