In my last post regarding AWS, I had explained how to launch Amazon ECS cluster including cloud formation, VPC and subnet creation, ELB and ECS security group creation, auto scaling group, launch configuration, elastic load balancer creation with the help of sample app by creating a task definition, scheduling tasks and configuring a cluster through Amazon ECS First Run Wizard.
In this blog, I will talk about auto scaling means how to
- Scale in / scale out EC2 instance in a cluster.
- Scale in / scale out containers(tasks) for a particular service.
Auto scaling is very helpful, as configuring EC2 instance in a auto scaling group or deploying and managing different containers of a same micro service manually is a lot complicated. It can take a lot of time and efforts to do that, but Amazon EC2 Container Service make it easier as it provide one click auto scaling feature that saves lot of time.
1. Auto Scale EC2 instance in a cluster
a. Open Amazon console: Click on cluster tab, then select your cluster in our case it is named as default:
b. Click on “ECS instances” tab: You find the option to “Scale ECS Instances” click on that and before scaling you can see currently, we have only one ECS instance running in the cluster.
c. Scale ECS Instances in cluster: Provide desired number of instances, so lets scale it to 2 from 1 and click on Scale.
d. In few seconds you will see two EC2 instances are running, Amazon ECS will automatically configured it to auto scaling group you don’t have to do anything.
2. Auto Scale containers/tasks for a service
a. Click on “Tasks” tab: As of now, we have only one container running for sample-webapp service.
b. Click on “Services” tab: Select service for which you want to scale out or scale in tasks. I’m selecting sample-webapp service for demonstration and click on update.
c. Scale tasks: Provide desired number of tasks you want to run for this service and then click on update service.
d. In a while you will see two containers are running.
So you see just on a click we are scaling up and we can also scale down ECS instances and container instances.
Hope I helped you to save your time and efforts. 🙂
In the next blog I will explain how to update task definition in order to run the updated version. Keep in touch !!