Saturday, June 27, 2020

Changing AWS instance type from M4 to M5 (Ena)

We cannot directly convert our instance from M4 to M5 as new instances are provided with enhanced networking capabilities through ENA (Elastic network Adapter).

If we have to convert, first we need to enable ENA support in M4 and then it will allow us to change M5 instance type.

To enable ENA we need to follow steps.

 

1.       Needs to stop the existing M4 instance.

Note: If instance is under Auto scaling group (ASG) and if we try to stop the instance automatically will get terminated. To Avoid, take the AMI of the instance and launch the instance using AMI outside ASG and follow the following step. Once ENA is enabled take another AMI and create launch configuration using M5 instance type and update the ASG with launch configuration

 

2.       Get the Instance Id of stopped instance.

 

3.       Run the following command to enable ENA. 

Note: To run this command you can use another active instance and also you should have proper role access to do.

 

aws ec2 modify-instance-attribute --instance-id <<instance Id>> --ena-support --region <<Region>>

 

4.       To Check you can use following command

aws ec2 describe-instances --instance-ids << instance Id>> --query "Reservations[].Instances[].EnaSupport" --region <<Region>>

 

5.       Change the instance type from Action->Instance Settings option

 

6.       Start the instance

You can refer following document for more details

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html


No comments:

Post a Comment