HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

ECS auto deploy with ECR

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
ecsautowithdeployecr

Problem

I'm using github, jenkins, aws ECR, aws ECS.

I want to deploy automatically when github have new commit. When github have new commit, github sends a event webhook to jenkins, jenkins builds the images and pushes to ECR with tag 'latest'.

I wonder how can I make my ECS service restart task and redeploy images automatically when the ECR image is changed?

Solution

I don't think you can trigger re-deployment based on ECS image being updated. You can however do it as part of your Jenkins pipeline - after you push to ECR as a next step in the pipeline can run a script that will reload the task.

In fact in my pipelines I deploy the ECS Tasks through CloudFormation templates and the CloudFormation stack update is part of the pipeline. That way I update the ECS Task definition automatically every time I push a new image to non-prod ECR.

Hope that helps :)

Context

StackExchange DevOps Q#5553, answer score: 3

Revisions (0)

No revisions yet.