How to change EC2 Instance type from AWS CLI

Step1: Stop the Instance

aws ec2 stop-instances --instance-ids INSTANCEID

Step2: Change Instance type. I’ve used r5.xlarge in the below example.

aws ec2 modify-instance-attribute --instance-id INSTANCEID --instance-type "{\"Value\": \"r5.xlarge\"}"

Step3: Start the Instance

aws ec2 start-instances --instance-ids INSTANCEID     

See also  How to rename an IAM user