question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
danwiltshirecommented, Jun 2, 2021

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:

  • My CDK project holds stacks for each application As such, the CDK project has its own repo. Main driver was to centralise our own CDK constructs, data, etc.
  • Our application repos now hold a Dockerfile which CDK builds and deploys to Fargate.

So yes, I’m all good, thanks all. Hopefully this helps you @Plasma? Feel free to ask further questions.

1reaction
skinny85commented, May 28, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found