Sometimes your current EC2 instance is over utilized meaning that, resources within EC2 instance such as CPU or memory are remaining at their peak all the time. In such case you need to scale up the EC2 instance. This article will quickly guide you about how to resize AWS EC2 instance (Backed by EBS volume) to match the load on the system. In case you want to resize your root EBS volume of EC2 instance follow this link.
How to resize AWS EC2 instance
In order to resize AWS EC2 instance which backed by EBS volume, basically need stop and start of the instance. Between stop and start instance you need to change the instance type of the EC2 instance.
Keep below points in mind while changing the instance type:
- Its not possible to resize an instance that was launched from a PV (paravirtual) AMI to an instance type that is HVM(hardware virtual machine).
- Your Private IP got changed during AWS resize activity.
- All 64 Bit Amazon EC2 instance are supported. However only following 32 bit instance type are supported:
- t2.nano
- t2.micro
- t2.small
- t2.medium
- c3.large
- t1.micro
- m1.small
- m1.medium
- c1.medium
So if you are resizing a 32-bit instance, you can only use above instance types.
In our demo we have currently “t2.micro” instance. which has got 1 vCPU and 1 Gb of memory. You can confirm the the same from respective OS.
[root@rhel ~]# nproc 1 [root@rhel ~]# grep MemTotal /proc/meminfo MemTotal: 1014960 kB [root@rhel ~]#
To increase the number of CPU and memory you need to change the instance type of as per below specification of instance type.
Family | Type | vCPUs | Memory (GiB) | Instance Storage (GB) |
---|---|---|---|---|
General purpose | t2.nano | 1 | 0.5 | EBS only |
General purpose | t2.small | 1 | 2 | EBS only |
General purpose | t2.medium | 2 | 4 | EBS only |
General purpose | t2.large | 2 | 8 | EBS only |
General purpose | t2.xlarge | 4 | 16 | EBS only |
General purpose | t2.2xlarge | 8 | 32 | EBS only |
General purpose | m4.large | 2 | 8 | EBS only |
General purpose | m4.xlarge | 4 | 16 | EBS only |
General purpose | m4.2xlarge | 8 | 32 | EBS only |
General purpose | m4.4xlarge | 16 | 64 | EBS only |
General purpose | m4.10xlarge | 40 | 160 | EBS only |
General purpose | m4.16xlarge | 64 | 256 | EBS only |
Compute optimized | c4.large | 2 | 3.75 | EBS only |
Compute optimized | c4.xlarge | 4 | 7.5 | EBS only |
Compute optimized | c4.2xlarge | 8 | 15 | EBS only |
Compute optimized | c4.4xlarge | 16 | 30 | EBS only |
Compute optimized | c4.8xlarge | 36 | 60 | EBS only |
Memory optimized | r4.large | 2 | 15.25 | EBS only |
Memory optimized | r4.xlarge | 4 | 30.5 | EBS only |
Memory optimized | r4.2xlarge | 8 | 61 | EBS only |
Memory optimized | r4.4xlarge | 16 | 122 | EBS only |
Memory optimized | r4.8xlarge | 32 | 244 | EBS only |
Memory optimized | r4.16xlarge | 64 | 488 | EBS only |
Memory optimized | r3.large | 2 | 15 | 1 x 32 (SSD) |
Memory optimized | r3.xlarge | 4 | 30.5 | 1 x 80 (SSD) |
Memory optimized | r3.2xlarge | 8 | 61 | 1 x 160 (SSD) |
Memory optimized | r3.4xlarge | 16 | 122 | 1 x 320 (SSD) |
Memory optimized | r3.8xlarge | 32 | 244 | 2 x 320 (SSD) |
Memory optimized | x1.16xlarge | 64 | 976 | 1 x 1920 |
Memory optimized | x1.32xlarge | 128 | 1952 | 2 x 1920 |
Storage optimized | d2.xlarge | 4 | 30.5 | 3 x 2048 |
Storage optimized | d2.2xlarge | 8 | 61 | 6 x 2048 |
Storage optimized | d2.4xlarge | 16 | 122 | 12 x 2048 |
Storage optimized | d2.8xlarge | 36 | 244 | 24 x 2048 |
Storage optimized | i2.xlarge | 4 | 30.5 | 1 x 800 (SSD) |
Storage optimized | i2.2xlarge | 8 | 61 | 2 x 800 (SSD) |
Storage optimized | i2.4xlarge | 16 | 122 | 4 x 800 (SSD) |
Storage optimized | i2.8xlarge | 32 | 244 | 8 x 800 (SSD) |
Storage optimized | i3.large | 2 | 15.25 | 1 x 475 (SSD) |
Storage optimized | i3.xlarge | 4 | 30.5 | 1 x 950 (SSD) |
Storage optimized | i3.2xlarge | 8 | 61 | 1 x 1900 (SSD) |
Storage optimized | i3.4xlarge | 16 | 122 | 2 x 1900 (SSD) |
Storage optimized | i3.8xlarge | 32 | 244 | 4 x 1900 (SSD) |
Storage optimized | i3.16xlarge | 64 | 488 | 8 x 1900 (SSD) |
Please follow this Link in case you need more details about instance type.
So our resulted instance type will be “t2.xlarge” which will have 4 vCPUs and 16 Gb of memory.
Please follow below procedure to resize AWS EC2 instance (Backed by EBS volume only).
Step1: Take the backup.
It’s always advisable to keep the backup of the instance. You can either create AMI image or you can use snapshot to take the backup of the volume.
Step2: Stop the EC2 instance.
- In order to stop the instance select the particular EC2 instance in EC2 console.
- Click on Actions then select select Instance State, and then choose Stop.
- In the next popup dialog box, choose Yes, Stop.
Step3: Change the instance type.
- Now select the instance, click on Actions, select Instance Settings, and then choose Change Instance Type.
- Now select the Instance Type that you want.
Please note that incompatible instance type will not be available for selection.
- Click on Apply to accept the new settings.
Here we have selected t2.xlarge since we need 4 vCPUs and 16 Gb of memory.
Step3: Start the EC2 instance.
- In order to start the instance select the particular EC2 instance in EC2 console.
- Click on Actions then select select Instance State, and then choose Start.
Confirmation:
Try to login to EC2 instance. Check the number of CPU and memory.
[root@rhel ~]# nproc 4 [root@rhel ~]# grep MemTotal /proc/meminfo MemTotal: 16004804 kB [root@rhel ~]#
This confirms that, we have successfully resize AWS EC2 instance.
Leave a Reply