Quick EC2 instance type change using aws command line only

Written by - 0 comments

Published on - Listed in AWS

Changing an EC2 instance type in AWS console (user interface) is not difficult at all - but it's even faster when the change happens through the aws command line.

In this example, three instances need to be "sidegraded" from t2.medium to t3.medium. Not only is t3 a tiny wee bit cheaper, the t3 instance drives run on NVMe which gives another boost on performance. But before simply changing the instance type from t2.X to t3.X one should know that newer instance types require the EnaSupport flag enabled. See post Cannot start AWS EC2 instance after changing instance type: Ensure that your instance is enabled for ENA for details.

Status quo: Terminator 2 (t2)

As mentioned, three instances need to be changed from t2.medium to t3.medium. A working aws cli, the necessary privileges (EC2 admin) and the instance ID are all the ingredients one needs.

First stop the instance(s) and wait until the instance is stopped.

EC2 t2 instances

ck@linux ~ $ instance=i-0bXXXXXXXXXXXXXc8


Modify instance (EnaSupport and instance type)

The instance can be queried if EnaSupport was enabled. It needs to be set if that wasn't already done:

ck@linux ~ $ aws ec2 describe-instances --instance-id ${instance} --query "Reservations[].Instances[].EnaSupport"
ck@linux ~ $ aws ec2 modify-instance-attribute --instance-id ${instance} --ena-support
ck@linux ~ $ aws ec2 describe-instances --instance-id ${instance} --query "Reservations[].Instances[].EnaSupport"

And the instance type can be changed using the same subcommand (modify-instance-attribute):

ck@linux ~ $ aws ec2 modify-instance-attribute --instance-id ${instance} --instance-type t3.medium

Start that thing!

Start the instance:

ck@linux ~ $ aws ec2 start-instances --instance-id ${instance}
    "StartingInstances": [
            "PreviousState": {
                "Code": 80,
                "Name": "stopped"
            "CurrentState": {
                "Code": 0,
                "Name": "pending"
            "InstanceId": "i-0bXXXXXXXXXXXXXc8"


How does this now show up in the EC2 console?

EC2 t3 instance

Success! The instance is now starting up as an upgraded t3.medium instance!


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.