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.
- Connect your ec2 instance and run following clean up commands. You update your package cache to get necessary package updates:
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get clean
- sudo apt-get autoclean
- sudo apt-get autoremove
- 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.
- 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:
- sudo apt-get upgrade -y linux-aws
- Now you want to check whether ENA is enabled or not on your instance, you will have to run following commands:
- aws ec2 describe-instances –instance-ids i-XXXXXXX –region XXXXXXX –query “Reservations[].Instances[].EnaSupport”
- Variable in above command is your instance(s) ID “i-67de34rtetcetc” and region e.g. “us-east-1”
- It may happen that AWS Cli is not installed on your instance. It will show error. To install AWS Cli, run following command:
- sudo apt-get install awscli
- Now run the “descibe-instances” command. It will show error that configuration is pending. So you run following command:
- aws configure
- 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.
- Now you are all set to run the “describe-instances” command again.
- If this command returns “True” then you are all set.
- aws ec2 describe-instances –instance-ids i-XXXXXXX –region XXXXXXX –query “Reservations[].Instances[].EnaSupport”
- Now you go to EC2 console on web, and follow steps below:
- Shutdown the EC2.
- Right click on the instance in the AWS console and select change instance.
- Select the new instance from here say t3.large.
- 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!