ec2 change instance type is the AWS CLI operation to resize a stopped, EBS-backed EC2 instance to a different instance type using modify-instance-attribute.
# Basic CLI syntax — instance MUST be stopped first
aws ec2 stop-instances --instance-ids i-0abcdef1234567890
aws ec2 modify-instance-attribute
--instance-id i-0abcdef1234567890
--instance-type "{"Value"": ""t2.medium""}""
Tested on Amazon Linux 2 with AWS CLI v2.15.0.
Syntax
The canonical AWS CLI form uses modify-instance-attribute with the --instance-type parameter. The instance must be in the stopped state before issuing the change.
aws ec2 modify-instance-attribute
[--instance-id <value>]
[--instance-type <JSON string>]
[--region <value>]
[--profile <value>]
[--cli-input-json <value>]
Options and Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--instance-id |
String | Required | ID of the EC2 instance to modify. |
--instance-type |
JSON string | Required | New instance type enclosed in JSON: e.g.
![]() Command Line Expert & Software EngineerWelcome! I’m Thomas Heinrich, a software engineer and system administrator with a deep passion for the Command Line Interface (CLI). With years of experience navigating the terminal, building backend architectures, and automating server deployments, I created this space to share practical, real-world terminal knowledge. Whether you are a beginner taking your first steps in a Linux environment or a seasoned DevOps engineer looking to optimize your deployment scripts, you will find actionable solutions here. My goal is to help you ditch the mouse, speed up your workflow, and harness the full power of the command line. |
