DEV Community

Cover image for Deployment Types in Amazon ECS (Elastic Container Service)
On-cloud7
On-cloud7

Posted on

Deployment Types in Amazon ECS (Elastic Container Service)

Introduction

Amazon Elastic Container Service (Amazon ECS) is a completely managed container orchestration solution that simplifies the deployment, management, and scaling of containerized applications on AWS. A key factor in operating applications on ECS is the method of deploying new versions of your application.

This blog will explore the deployment types in Amazon ECS, detail how each operates, identify when to utilize them, and discuss best practices. This blog is particularly beneficial for DevOps engineers, cloud engineers.

What Are ECS Deployment Types?

Deployment types in ECS specify the manner in which new versions of a task definition are introduced to your active services. ECS accommodates various deployment strategies based on your usage of:

1. ECS with EC2 launch type
2. ECS with AWS Fargate
3. ECS with an Application Load Balancer

The main ECS deployment types are:

1. Rolling Deployment (ECS Default)
2. Blue/Green Deployment (Using AWS CodeDeploy)
3. External Deployment (Custom / Third-party)

1. Rolling Deployment (ECS Default Deployment):
Overview:
Rolling deployment is the standard deployment method in Amazon ECS. In this approach, ECS systematically swaps out old tasks for new ones according to the revised task definition

How It Works:

  • ECS initiates new tasks utilizing the updated task definition.
  • Previous tasks are being phased out gradually.
  • The procedure is regulated by deployment configuration settings

2. Blue/Green Deployment (Using AWS CodeDeploy):
Overview:
Blue/Green deployment on ECS utilizes AWS CodeDeploy. This approach operates two distinct environments:

Blue – Present production edition

Green – Updated edition

Traffic is transitioned from Blue to Green in a regulated way

How It Works:
New assignments are initiated in the Green setting.
The load balancer directs traffic to Green.

Traffic management can be:

  • Simultaneously
  • Straight
  • Canary Completed old (blue) tasks are closed after success

Requirements:

  • Application Load Balancer (ALB)
  • ECS service with CodeDeploy deployment controller
  • Target groups (Blue & Green)

3. External Deployment (Custom Deployment):
Overview:
External deployment enables you to have complete control over the deployment process by utilizing third-party or custom tools rather than relying on ECS-managed deployments

How It Works:
ECS does NOT oversee task substitution.

Tasks and services are updated by an external system.

You manage scaling, traffic, and rollback

Common Tools Used:

  • Jenkins
  • GitHub Actions
  • Argo CD
  • Custom scripts using AWS SDK / CLI

Conclusion:

Amazon ECS offers various deployment choices to suit diverse application requirements. Rolling deployments are straightforward and economical, whereas Blue/Green deployments provide enterprise-level reliability and eliminate downtime. For complex situations, External deployments provide you with complete control.

Grasping these deployment types will assist you in creating strong, scalable, and dependable containerized applications on AWS ECS

Reference:

  1. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html
  2. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-bluegreen.html
  3. https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html
  4. https://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html
  5. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-external.html
  6. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html
  7. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html

Top comments (0)