Skip to main content

Updating a Running Amazon ECS Application

Hands-On Lab

 

Photo of Mark Richman

Mark Richman

AWS Training Architect II in Content

Length

01:00:00

Difficulty

Intermediate

In this hands-on lab, we will learn how to update a running ECS-deployed application without downtime. You can change the task definition, platform version, deployment configuration, or the number of desired tasks (or any combination of these). The goal is to ensure the web application continues to respond without interruption during the update.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Updating a Running Amazon ECS Application

Introduction

In this hands-on lab, we will learn how to update a running ECS-deployed application without downtime. You can change the task definition, platform version, deployment configuration, or the number of desired tasks (or any combination of these). The goal is to ensure the web application continues to respond without interruption during the update.

Log in to the AWS Management Console with the credentials provided on the lab instructions page. Make sure you are using the us-east-1 (N. Viriginia) region.

Update the Running Service

  1. In the AWS Management Console, navigate to the ECS service.
  2. Click Clusters in the left sidebar.
  3. On the Clusters page, click the name of our service to open it.
  4. Under Service Name, click website-service.
  5. Under Target Group Name, click website-service.
  6. Click Load Balancers in the left sidebar.
  7. Scroll down to the Description tab at the bottom of the screen, and copy the DNS name to your clipboard.
  8. Open a new tab of your browser and enter the DNS name in the address bar.
  9. Go back to the ECS Management Console.
  10. Click Update.
  11. Under Revision, select 1.
  12. Click Next step three times.
  13. Click Update Service.
  14. Click View Service.
  15. Click the Tasks tab.
  16. Click the refresh icon on the right side of the screen.
  17. Wait a few minutes for the new task definition's status to change to RUNNING.

Verify Service Updated via ALB

  1. Navigate to the DNS name of the application load balancer (ALB).
  2. Refresh the page multiple times to view the updated version of the service.
  3. Go back to the ECS Management Console.
  4. Click Target Groups in the sidebar.
  5. Click the Targets tab at the bottom of the screen.
  6. Observe that one target's status is healthy and the other is draining.
  7. Wait a few minutes, then refresh the page and observe that the draining target is now gone.
  8. Go back to the ECS cluster page.
  9. Refresh the task list until the task corresponding to the previous application version is now stopped.

Conclusion

Congratulations, you've successfully completed this hands-on lab!