Whenever we build ECS clusters, the topic of ECS scaling seems to be the most confusing for our customers. We wrote this blog post to explain two basic concepts you need to know about: scaling ec2 instances and scaling containers.
Scaling EC2 instances
As illustrated in the image above, you should configure your autoscaling to auto-scale based on the reserved capacity. Doing so will enable ECS to spin up new instances when you run out of memory.
If you look at this CloudFormation link, you’ll notice that we’re scaling up EC2 instances based on MemoryReservation. We reserve additional memory each time we launch a container and use auto scaling to launch additional instances once we run out of capacity to launch additional instances.
You can refer to the reserved metrics in CloudWatch and click on the ClusterName.
In the example below, we have reserved 65% of capacity already. If you continue to launch more containers, they will fail to launch due to a lack of capacity.
Scaling ECS services
You should always keep an eye on the utilization of memory and CPU whenever you use an ECS console. Memory utilization is a measurement of how much memory is being used by containers. You can launch additional containers if you run out of memory.
You must also scale Docker containers according to memory utilization, CPU utilization, and other relevant utilization metrics. You can launch additional containers if you run out of memory.
Here is an example of memory utilization for a service running on ECS.
We mostly configure auto-scaling using Terraform or CloudFormation, but you can also configure service scaling from the AWS console. All you have to do is select a service running in the cluster and click on update.
We would love to learn how you are using ECS autoscaling. Please leave a comment with any tips.
nClouds Named a 2024 Geography and Global AWS Partner Award Finalist for MSP and SaaS Categories
nClouds recognized as MSP Partner of the Year and SaaS SI Partner of the Year finalist, ranking highly among the many AWS Partners around...
Read MoreRead More
Blog Post
Common Challenges in Cloud Security and Compliance (And How to Overcome Them)
As businesses increasingly migrate to cloud environments, the need for robust security and compliance measures has never been more critical. However, achieving and maintaining...
Read MoreRead More
Blog Post
nClouds Takes Part in Panel Discussing Technology Transformation Strategies
Industry experts gathered for a highly anticipated panel focusing on “Transforming for Success: Technical Optimization Strategies to Enhance Portfolio Company Valuation.”
Read MoreRead More
Blog Post
Navigating VMware Price Hikes: Why Migrating to AWS Could Be Your Best Option
The recent acquisition of VMware by Broadcom has led to a turbulent period for many organizations, with price hikes leaving customers in difficult positions.