Docker containers are easily one of my favorite pieces of new technology of the
last decade. They’ve immensely simplified how I work locally, no more virtual
machines, no more trying to keep my local development environment and production
servers in parity, and no need for command-line sloths like
They’ve also changed how we deploy applications to production, going as far as eliminating the need to run dedicated servers and simplifying the hell out of clustering applications.
As far as containers have taken us over the years, containers do need to be restarted between deployments from time to time. Memory leaks, gremlins in our code, and such, contribute to this need.
At Mailshake, we use AWS Elastic Container Service (ECS) by way of AWS Fargate for many of our microservices, and one such service has been experiencing a ghost in the machine, if you will.
By the way, WE’RE HIRING a backend engineer to join the Mailshake engineering team to help us improve our sales outreach product as well as bust some of them ghosts ;)
With that all being said, executing an entire CI/CD pipeline to redeploy an ECS container tends to be over kill. Running linting, tests, and then finally deploying is time consuming and unnecessary when all you need to do is get things redeployed from an already tested and deployed image.
Fortunately, we don’t have to go through the usual CI/CD pipeline, and can simply update the service, and tell it to force a new deployment, as nothing will actually be changing.
This can be done via the AWS Console (direct links omitted as they are region specific and I don’t want to add any unnecessary confusion):
- Log into the AWS Management Console.
- Go to Elastic Container Service.
- Go to Clusters.
- Click on the cluster that your service is in.
- Click on the service you’d like to restart.
- Click Update.
- Check Force new deployment about half way down the page.
- Click Skip to review.
- Click Update service.
- Wait patiently as your service restarts!
No much to it, but there are quite a few steps involved to make it happen. If you’re a fan of the AWS CLI (as I am), you can accomplish everything outlined above with this command:
aws ecs update-service --cluster :clusterName --service :serviceName --force-new-deployment
You may still want to navigate out to ECS to monitor the status of the deployment, that’s up to you.