CodexBloom - Programming Q&A Platform

AWS CodePipeline scenarios to Deploy Changes to ECS with 'No updated Task Definition' scenarios

πŸ‘€ Views: 81 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-09
aws codepipeline ecs yaml

I'm having trouble with I'm confused about I'm working on a personal project and I'm having trouble with my AWS CodePipeline setup, specifically when it comes to deploying changes to my ECS service. My pipeline runs successfully, but the deployment fails with the behavior message `No updated Task Definition`. I have made sure to register a new task definition revision in my CodePipeline and I can see it in the console. However, the pipeline does not seem to recognize that the new revision should trigger an update to the ECS service. Here’s a snippet of my `buildspec.yml` where I register the new task definition: ```yaml version: 0.2 phases: pre_build: commands: - echo Logging in to Amazon ECR... - aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin <account_id>.dkr.ecr.us-west-2.amazonaws.com - REPOSITORY_URI=<account_id>.dkr.ecr.us-west-2.amazonaws.com/my-app - IMAGE_TAG=latest build: commands: - echo Build started on `date` - echo Building the Docker image... - docker build -t my-app . - echo Pushing the Docker image... - docker tag my-app:latest $REPOSITORY_URI:latest - docker push $REPOSITORY_URI:latest - echo Registering task definition... - printf '[{"name":"my-app","image":"%s","memory":512,"cpu":256}]' $REPOSITORY_URI:latest > task-def.json - aws ecs register-task-definition --cli-input-json file://task-def.json ``` I've confirmed that the task definition is updated, and the correct image URI is being used. The `Deploy` stage in my pipeline is configured to use the latest task definition revision, but it seems to skip deploying the new revision altogether. I have also checked the permissions for the CodePipeline role to ensure it has access to ECS actions, but still no luck. Is there something I might be missing in my pipeline configuration, or perhaps in my task definition registration? Any advice would be greatly appreciated! I'm working on a CLI tool that needs to handle this. How would you solve this? Is there a better approach? The project is a web app built with Yaml.