0
0
AWScloud~30 mins

ECS service auto scaling in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
ECS Service Auto Scaling Setup
📖 Scenario: You manage a web application running on AWS ECS (Elastic Container Service). To handle varying traffic, you want the ECS service to automatically adjust the number of running tasks.This project guides you to create an ECS service with auto scaling configured to increase or decrease the number of tasks based on CPU usage.
🎯 Goal: Build an ECS service with auto scaling enabled that adjusts the number of tasks between 1 and 4 based on CPU utilization thresholds.
📋 What You'll Learn
Create an ECS cluster named my-ecs-cluster
Create an ECS service named my-ecs-service running a sample task
Configure auto scaling for the ECS service with minimum 1 and maximum 4 tasks
Set a target tracking scaling policy to maintain CPU utilization at 50%
💡 Why This Matters
🌍 Real World
Auto scaling ECS services is common in real applications to save costs and maintain performance during traffic changes.
💼 Career
Cloud engineers and DevOps professionals often configure ECS auto scaling to ensure applications run smoothly and efficiently.
Progress0 / 4 steps
1
Create ECS Cluster
Create an ECS cluster named my-ecs-cluster using AWS CLI syntax.
AWS
Need a hint?

Use the AWS CLI command aws ecs create-cluster with the --cluster-name option.

2
Create ECS Service
Create an ECS service named my-ecs-service in cluster my-ecs-cluster with desired count 1 and a sample task definition sample-task.
AWS
Need a hint?

Use aws ecs create-service with --cluster, --service-name, --task-definition, and --desired-count options.

3
Configure Auto Scaling Target
Create an Application Auto Scaling target for the ECS service my-ecs-service in cluster my-ecs-cluster with minimum capacity 1 and maximum capacity 4.
AWS
Need a hint?

Use aws application-autoscaling register-scalable-target with the correct --resource-id and capacity limits.

4
Create Target Tracking Scaling Policy
Create a target tracking scaling policy named cpu-utilization-policy for the ECS service my-ecs-service in cluster my-ecs-cluster to maintain CPU utilization at 50%.
AWS
Need a hint?

Create a JSON file named policy.json with the target tracking configuration and use it with put-scaling-policy.