1
votes

I am using elastic beanstalk to deploy the web services as Docker containers on AWS using ECS. Default load balancer available in EBS provides me network-level autoscaling to handle the load on EC2 instance.

How to handle auto-scaling in application level and use dockerization features using ECS like Kubernetes handling the dockers? I want to scale my individual dockers when it receives more memory or CPU usage. Please help me to achieve this.

3

3 Answers

0
votes

You can have the ECS cluster managed by an auto scaling group . This would take care of the hardware underlying the docker images. As far as the containers themselves are concerned, you can go the way of application auto scaling.

Since both these services can be configured to answer to CW alarms for both downscale and upscale, you can have a HIGH cpu/ram alarm policy to add 1 host and 2 container replicas for example and remove the same amount on a LOW alarm.

Hope this helps

0
votes

You can use scaling of task when you are updating your service which is attached with a cloudwatch alarm to scale up/down and called as service autoscaling.

Ref: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html

0
votes

These are not the answers to this question. Using multicontainer docker environment on ELB service, we can specify (within the Dockerrun.aws.json) our docker services and their relationships, but we cannot specify the number of instances for individual services. This means that if we want to scale our ELB docker services, we can do that useing autoscale groups and CloudWatch alarms, but this means that our entire docker service environment will be affected: if we have 3 docker services, we can scale only all them together, not individual services.

The only think you can do is to use Elastic Container Service (ecs). Within this service you will create the cluster (similar to Kubernetes approach), then create individual services which will be able to run multiple tasks, and each task will be the specification for individual docker container. This way you will be able to run your services in desired way and scale them appropriately.