Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic deployment of Docker containers on AWS ECS using Jenkins or Job Scheduler

Currently we build our Docker containers and publish them to Amazon ECR. We have created TaskDefinitions and are able to deploy them manually on an ECS Cluster. So a new deployment involves manual update of the TaskDefinition.

Now we would like to automate the deployment so when a Docker Image is successfully build using Jenkins and published to the ECR repo we would like to replace the current running version with the newly build one.

Next to this we would like to give people the opportunity to launch a specific version of 1 or more combinations of docker containers. Any suggestion on how we could implement a continuous cycle without manually updating the TaskDefinitions?

like image 754
Marco Avatar asked Feb 10 '16 14:02

Marco


2 Answers

A more simple solution for this might be to use the ecs-deploy script from here:

https://github.com/silinternational/ecs-deploy

After my container has been built and deployed to dockerhub it's simply a matter of:

ecs-deploy -k $AWS_KEY -s $AWS_SECRET -r $AWS_REGION -c $CLUSTER_NAME -n $SERVICE_NAME -i $DOCKER_IMAGE_NAME

and that does it.

like image 131
bwobbones Avatar answered Nov 16 '22 23:11

bwobbones


This article describes how to do Continuous deployments to ECS with Jenkins. It uses a shell script after the image has been built and pushed to update an ECS service with a new task definition revision. Hope it helps.

like image 5
dstroppa Avatar answered Nov 17 '22 00:11

dstroppa