AWS Logo
Menu

Scaling Workloads on AWS

AutoScaling across services like EC2, EKS and ECS

Saketh Gaddam
Amazon Employee
Published Apr 1, 2025
In today's rapidly evolving digital landscape, ensuring that your applications can handle varying workloads efficiently is much required. AWS offers a suite of powerful services designed to help you scale your applications seamlessly, ensuring high availability, performance, and cost-effectiveness. Let's delve into how you can leverage AWS services to scale your applications effectively:
  1. If you are hosting your application on Amazon EC2 (Elastic Compute Cloud)**:**Configure Auto Scaling groups to automatically add or remove EC2 instances based on predefined conditions such as CPU utilization or traffic patterns. This ensures your application can handle traffic spikes while optimizing costs during quieter periods.
    Autoscalinggroup
    Auto scaling group
    How to add Auto Scaling groups to your current application :-
  1. If you are hosting your application on Amazon Elastic Container Service (Amazon ECS)**:**ECS follows an Application First scaling approach, where the scaling is based on the number of desired.ECS has two type of scaling activities:
    ECS Service / Application Scaling: This refers to the ability to increase or decrease the desired count of tasks in your Amazon ECS service based on dynamic traffic and load patterns in the workload. Amazon ECS publishes CloudWatch metrics with your service’s average CPU and memory usage. You can use these and other CloudWatch metrics to scale out your service (add more tasks) to deal with high demand at peak times, and to scale in your service (run fewer tasks) to reduce costs during periods of low utilization.Amazon ECS Service Auto Scaling supports the following types of automatic scaling:
- Target tracking scaling policies— Increase or decrease the number of tasks that your service runs based on a target value for a specific metric. This is similar to the way that your thermostat maintains the temperature of your home. You select temperature and the thermostat does the rest.
- Step scaling policies— Increase or decrease the number of tasks that your service runs based on a set of scaling adjustments, known as step adjustments, that vary based on the size of the alarm breach.
- Scheduled Scaling—Increase or decrease the number of tasks that your service runs based on the date and time.
ECS Container Instances Scaling: This refers to the ability to increase or decrease the desired count of EC2 instances in your Amazon ECS cluster based on ECS Service / Application scaling. For this kind of scaling, it is typical practice depending upon Auto Scaling group level scaling policies.
To scale the infrastructure using the Application First approach on ECS, we will use Amazon ECS cluster Capacity Providers to determine the infrastructure in use for our tasks and we will use Amazon ECS Cluster Auto Scaling (CAS) to enables to manage the scale of the cluster according to the application needs.
https://ec2spotworkshops.com/ecs-spot-capacity-providers/introduction/scaling_ecs_workloads.html
https://aws.amazon.com/blogs/containers/deep-dive-on-amazon-ecs-cluster-auto-scaling/
  1. If you are hosting your application on Amazon Elastic Kubernetes Service (Amazon EKS)**:**Amazon EKS is a managed Kubernetes service that makes scaling containerized workloads easier:Horizontal Pod Autoscaling (HPA): Configure HPA to automatically adjust the number of pods in a deployment or replica set based on resource utilization, ensuring optimal performance and resource utilization.Cluster Autoscaling: Integrate with the Kubernetes Cluster Autoscaler to dynamically adjust the number of worker nodes in the EKS cluster based on resource requirements.Amazon EKS supports two autoscaling products:
  • Karpenter: Karpenter is a flexible, high-performance Kubernetes cluster autoscaler that helps improve application availability and cluster efficiency. Karpenter launches right-sized compute resources (for example, Amazon EC2 instances) in response to changing application load in under a minute. Through integrating Kubernetes with AWS, Karpenter can provision just-in-time compute resources that precisely meet the requirements of your workload. Karpenter automatically provisions new compute resources based on the specific requirements of cluster workloads. These include compute, storage, acceleration, and scheduling requirements. Amazon EKS supports clusters using Karpenter, although Karpenter works with any conformant Kubernetes cluster.https://aws.amazon.com/blogs/aws/introducing-karpenter-an-open-source-high-performance-kubernetes-cluster-autoscaler/
  • Cluster Autoscaler: The Kubernetes Cluster Autoscaler automatically adjusts the number of nodes in your cluster when pods fail or are rescheduled onto other nodes. The Cluster Autoscaler uses Auto Scaling groups. For more information, see Cluster Autoscaler on AWS.
    https://aws.github.io/aws-eks-best-practices/cluster-autoscaling/
  • AutoScaling
    AutoScaling
If you are hosting application on Amazon Elastic Container Service (Amazon ECS) or Amazon Elastic Kubernetes Service (Amazon EKS) , you have to take care of container scaling as well as node scaling in order to accommodate the containers. You can offload the node scaling to AWS by using serverless compute for containers – AWS Fargate
AWS Fargate is a serverless, pay-as-you-go compute engine that lets you focus on building applications without managing servers. AWS Fargate is compatible with both Amazon Elastic Container Service (Amazon ECS) and Amazon Elastic Kubernetes Service (Amazon EKS). Select any OCI-compliant container image, define memory and compute resources, and run the container with serverless compute. With multiple CPU architectures and operating systems supported, you can enjoy the benefits across a wide variety of applications.
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments