Upgrade AWS EC2 instance to T3, A1, C5, etc. for guest OS Ubuntu 16.04 LTS

So you decide to upgrade your AWS instance from say t2.medium(4gb ram) to t2.large (8gb ram) but your network admin suggested that rather switch to t3.large(8gb ram) because t3 is part of the newer generation series compared to t2. AWS has introduced the following instances which are based on their own Hypervisor — nitro.

A1, C5, C5d, C5n, M5, M5a, M5d, p3dn.24xlarge, R5, R5a, R5d, T3, and z1d

Although the new AMI released by AWS has got the new driver, you cannot just change the existing instance to the new type to get the advantage of it, unless you update the driver and modify ec2 metadata to let it know that it has the drivers to use the new hypervisor.

There is a great number of articles which guide you on how to do that. But the following guide is a full step-by-step complete instruction to upgrade from t2.medium to t3.large for Ubuntu 16.04 LTS.

  1. Connect your ec2 instance and run following clean up commands. You update your package cache to get necessary package updates:
    1. sudo apt-get update
    2. sudo apt-get upgrade
    3. sudo apt-get clean
    4. sudo apt-get autoclean
    5. sudo apt-get autoremove
  2. If your command prompt shows “*** System restart required” , please reboot your system. Just to make sure everything is latest and working, rung all 5 commands in Step 1 again. Now you are all set for an upgrade.
  3. Ubuntu 16.04 and later include the linux-aws package, which contains the NVMe and ENA drivers required by Nitro-based instances. Upgrade the linux-aws package to receive the latest version as follows:
    1. sudo apt-get upgrade -y linux-aws
  4. Now you want to check whether ENA is enabled or not on your instance, you will have to run following commands:
    1. aws ec2 describe-instances –instance-ids i-XXXXXXX –region XXXXXXX –query “Reservations[].Instances[].EnaSupport”
      1. Variable in above command is your instance(s) ID “i-67de34rtetcetc” and region e.g. “us-east-1”
      2. It may happen that AWS Cli is not installed on your instance. It will show error. To install AWS Cli, run following command:
        1. sudo apt-get install awscli
      3. Now run the “descibe-instances” command. It will show error that configuration is pending. So you run following command:
        1. aws configure
        2. It will ask you Access Key ID and Secret. This you can generate from AWS Web Control Panel under “My Security Credentials” i.e IAM Management Console. Here you go to Users, add new user, give access type as “Programmatic Access” and follow the instructions on the screen.
        3. Now you are all set to run the “describe-instances” command again.
    2. If this command returns “True” then you are all set.
  5. Now you go to EC2 console on web, and follow steps below:
    1. Shutdown the EC2.
    2. Right click on the instance in the AWS console and select change instance.
    3. Select the new instance from here say t3.large.
    4. Start the new instance.

You are all set!

I wanted to cover a few things which were not there in this article I referred to upgrade my instance. In fact, that article has much more detailed instructions for different OS types on more. Definitely go through that article as well.

All credit goes to my network admin team and the above article.

Thank you!

Get a quote

Share a project brief with us and we will schedule a FREE Discovery Call with you. Give us a call or fill out the form below.

      protected by reCAPTCHA & Google privacy & terms apply.