I have an ECS cluster with a service in it that is running a task I have defined. It's just a simple flask server as I'm learning how to use ECS. Now I'm trying to understand how to update my app and have it seamlessly deploy.
- I start with the flask server returning
Hello, World! (rev=1). - I modify my
app.pylocally to sayHello, World! (rev=2) - I rebuild the docker image, and push to ECR
- Since my image is still named
image_name:latest, I can simply update the service and force a new deployment with:aws ecs update-service --force-new-deployment --cluster hello-cluster --service hello-service - My minimum percent is set to 100 and my maximum is set to 200% (using rolling updates), so I'm assuming that a new EC2 instance should be set up while the old one is being shutdown. What I observe (continually refreshing the ELB HTTP endpoint) is that that the rev=? in the message alternates back and forth:
(rev=1)then(rev=2)without fail (round robin, not randomly). - Then after a little bit (maybe 30 secs?) the flipping stops and the new message appears:
Hello, World! (rev=2) - Throughout this process I've noticed that no more EC2 instances have been started. So all this must have been happening on the same instance.
What is going on here? Is this the correct way to update an application in ECS?