Vertical scaling (scaling up/down) in Amazon EC2 means modifying the instance type to provide more or fewer resources (vCPU, memory, network throughput, or storage).
For example:
- If your application is running on a t2.micro (1 vCPU, 1 GB RAM) and needs more capacity, you can stop the instance and change it to a t2.medium (2 vCPU, 4 GB RAM).
- This gives the same application more power without changing the architecture.
Key Points about Vertical Scaling in EC2:
- Requires downtime – Most instance type changes need the instance to be stopped before resizing.
- Limited by instance family – You can only scale within available EC2 instance types (there’s a maximum size, unlike horizontal scaling which can add unlimited instances).
- Good for quick fixes – Ideal when you have a single application or database that needs more CPU or memory temporarily.
- Not always cost-efficient – Scaling vertically can get expensive quickly compared to horizontal scaling.
- Often used with Auto Scaling – Many architectures combine vertical scaling with horizontal scaling (adding more instances behind a load balancer) for high availability.
How to Vertically Scale an Amazon EC2 Instance
Scaling vertically = Changing the EC2 instance type (e.g., t2.nano → t2.micro).
Prerequisites
To ensure successful completion of this lab, you must have prior experience in creating EC2 instances and be familiar with their essential components. If you feel that your knowledge in this area is insufficient, we highly recommend taking the following labs to gain the necessary understanding:
Creating an Amazon EC2 instance (Linux)
Setting up a web server on an EC2 instance.
Objectives
In this lab, you will:
Guided Lab: Vertically scaling an Amazon EC2 instance
Learn what it means to scale an EC2 instance vertically
Learn how to change the type of an EC2 instance to scale vertically
Lab Steps
1. Using AWS Management Console
- Log in to AWS Management Console → Go to EC2 Dashboard.
- Select the instance you want to resize.
- Stop the instance
- Right-click → Instance State → Stop instance.
- ⚠️ Note: Stopping will cause downtime.
- Once stopped, select Actions → Instance Settings → Change Instance Type.
- From the dropdown, select the new instance type (e.g., t2.micro).
- Click Apply.
- Start the instance again.
- Verify by connecting via SSH → run:
lscpu # shows vCPUs
free -h # shows RAM
2. Using AWS CLI
👉 Make sure AWS CLI is installed and configured with proper credentials.
Step 1: Stop the instance
aws ec2 stop-instances --instance-ids i-0abcd1234efgh5678
Step 2: Change the instance type
aws ec2 modify-instance-attribute --instance-id i-0abcd1234efgh5678 --instance-type "{\"Value\": \"t3.medium\"}"
Step 3: Start the instance
aws ec2 start-instances --instance-ids i-0abcd1234efgh5678
Step 4: Verify new size
aws ec2 describe-instances --instance-id i-0abcd1234efgh5678 --query "Reservations[*].Instances[*].InstanceType" --output text
3. Best Practices for Vertical Scaling
✅ Always check compatibility – some instance families may not be supported for your AMI or region.
✅ Plan for downtime – scaling up/down requires stopping the instance.
✅ Consider EBS volume size – if storage is too small, also increase EBS volume.
✅ Monitor with CloudWatch – track CPU, RAM, and Network to decide when scaling is needed.