Skip to main content
Uncategorized

AWS CLI EC2 Change Instance Type Reference | Resize Stopped

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.