From a local code change to a running update on AWS
Johnny Geambasu johnnygeambasu.com
Fargate doesn't watch your files. Every code change must travel this full path to go live.
templates/index.html — updated message
templates/index.html<h1> and <p> textcontain-my-flask/ where the Dockerfile lives.
docker buildx build \
--platform linux/amd64 \
-t contain-my-flask:1.0.1 .
. at the end tells Docker to look for the Dockerfile in the current directory. A missing space causes an error.
:1.0.0 to :1.0.1) so you can always roll back to a previous image if something breaks.
Terminal output — build finished in 6.4s
aws ecr get-login-password \
--region eu-west-2 \
| docker login \
--username AWS \
--password-stdin \
664047078509.dkr.ecr.eu-west-2.amazonaws.com
# Tag with the ECR URI
docker tag contain-my-flask:1.0.1 \
664047078509.dkr.ecr.eu-west-2\
.amazonaws.com/contain-my-flask:1.0.1
# Push to ECR
docker push \
664047078509.dkr.ecr.eu-west-2\
.amazonaws.com/contain-my-flask:1.0.1
The ECS Task Definition is the blueprint that tells Fargate which image to run. It points to a specific image tag. Just pushing a new image to ECR doesn't change what Fargate runs — you have to update the blueprint too.
--force-new-deployment without updating the task definition restarts the service but pulls the old image. The change never goes live.
flask-task:1.0.0 to :1.0.1In the Console: ECS → Clusters → flask-cluster → flask-service → Update. Point to the new task definition revision, then click Update.
# 1. Get the task ARN
aws ecs list-tasks \
--cluster flask-cluster \
--region eu-west-2 \
--query "taskArns[0]" --output text
# 2. Get the network interface ID
aws ecs describe-tasks \
--cluster flask-cluster \
--tasks <task-arn> \
--region eu-west-2 \
--query "tasks[0].attachments[0].details"
# 3. Get the public IP
aws ec2 describe-network-interfaces \
--network-interface-ids <eni-id> \
--region eu-west-2 \
--query "NetworkInterfaces[0].Association.PublicIp" \
--output text
aws ecs describe-services \
--cluster flask-cluster \
--service flask-service \
--region eu-west-2 \
--query "services[0].deployments"
rolloutState: COMPLETED and runningCount: 1 before visiting the new IP.
http://13.42.63.43:3030 / Running on AWS Fargate / eu-west-2
Fargate doesn't watch your files. A code change does nothing until you rebuild the image, push it to ECR, update the task definition, and redeploy the service.
Always use a new image tag. Bumping the version (:1.0.0 to :1.0.1) gives you a clear history and the ability to roll back instantly.
The IP changes every deployment. Fargate assigns a new public IP each time a task restarts. Always look it up after a deployment.
Force-new-deployment alone is not enough. It restarts the service but uses the same image. You must update the task definition to a new revision first.