Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Scaling With Amazon ECS

DZone's Guide to

Scaling With Amazon ECS

You can quickly and easily configure your AWS services and containers to auto-scale up or down, depending on the load and attention your projects are getting.

· Cloud Zone ·
Free Resource

Container Monitoring and Management eBook: Read about the new realities of containerization.

In my last post regarding AWS, I explained how to launch Amazon ECS clusters, including Cloud Formation, VPC and subnet creation, ELB and ECS security group creation, auto scaling groups, launch configuration, elastic load balancer creation with the help of a sample app by creating a task definition, scheduling tasks, and configuring a cluster through the Amazon ECS First Run Wizard.

In this post, I will talk about auto-scaling, which means:

  • Scaling in/out of an EC2 instance in a cluster.
  • Scaling in/out containers (tasks) for a particular service.

Auto-scaling is obviously very helpful. Configuring EC2 instances in an auto-scaling group or deploying and managing different containers of the same microservice manually is pretty complicated. It can take a lot of time and effort to do that, but Amazon EC2 makes it easier, providing one-click auto-scaling features, which saves a lot of time.

Auto-Scale EC2 Instances in a Cluster

Open the Amazon console: Click on cluster tab, then select your cluster. In our case, it is named "default":

1.png

Click on the “ECS instances” tab: Find the option to “Scale ECS Instances” and click on that. Before scaling, you can see that we have only one ECS instance running in the cluster.

2.png

Scale ECS Instances the in cluster: Provide the desired number of instances. Here's let's set it to scale up to two from one. Once you've chosen your desired number, click on Scale.

3.png

In a few seconds, you will see two EC2 instances up and running, Amazon ECS will automatically configure it, so you don’t have to do anything.

4.png

Auto-Scale Containers/Tasks for a Service

Click on the “Tasks” tab: As of now, we have only one container running for our aptly named sample-webapp service.

5.png

Click on the “Services” tab: Select the service for which you want to scale out or scale in your tasks. I’m selecting sample-webapp for this demonstration. Then, click on update.

6.png

Scale tasks: Provide the desired number of tasks you want to run for this service and then click on Update Service.

7.png

In a while, you will see that two containers are running.

8.png

So you see, in just one click, we are scaling up and down our ECS instances and container instances. I hope I helped you save time and effort. In my next article, I will explain how to update task definitions in order to run the updated version. Keep in touch!

The Essentials of Container Monitoring: Learn the 4 principles of application containerization. Download Now.

Topics:
amazon ecs ,cloud scaling ,cloud ,tutorial ,auto-scaling

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}