How do I expand the Amazon EBS root volume of my Amazon EC2 Windows instance?

Last updated: 2020-01-30

I've run out of space on my Amazon Elastic Compute Cloud (Amazon EC2) Windows instance. How can I dynamically expand the Amazon Elastic Block Store (Amazon EBS) volumes of my Windows instances? 

Resolution

An Amazon EC2 Windows instance created from an Amazon Machine Image (AMI) has a default 30 GB gp2 (General Purpose SSD) Amazon EBS root volume. You can expand the root volume using the Amazon EC2 console or the AWS Command Line Interface (AWS CLI). Then, extend the volume’s file system to use the new storage capacity.

Expand the root volume and extend the file system using the Amazon EC2 console

1.    From the Amazon EC2 console, choose Instances from the navigation pane.

2.    Select the instance that you want to expand. From the Description tab, choose the volume listed for Block devices. Then, choose the EBS ID.

3.    Select the volume. For Actions, choose Modify Volume.

4.    Choose the Volume Type, and then enter the Size. If you choose an io1 volume, enter the number of IOPS.

5.    Choose Modify, and then choose Yes. Refresh the console page. In the Description tab, the State shows the progress of optimization until the modification is complete.

Note: Windows root volumes are the master boot record (MBR) by default, and these volumes can be extended up to 2 TB.

6.    You must extend the Windows file system for the EBS volume increase to reflect in the OS or Disk Management. Connect to your EC2 Windows instance using Remote Desktop Protocol (RDP).

7.    Open a command prompt, and then run the diskmgmt.msc command to launch Disk Management. For Action, choose Refresh.

8.    Open the context (right-click) menu for the Volume, and then choose Extend Volume.

9.    Choose Next, Next, Finish.

Repeat these steps for any additional volumes.

Expand the root volume and extend the file system using the AWS CLI

1.    Run a command similar to the following. Replace the <placeholders> with your values:

aws ec2 modify-volume --region <regionName> --volume-id <volumeId> --size <newSize> --volume-type <newType> --iops <newIops>

Note: To view the progress of your task, run the following command:

aws ec2 describe-volumes-modifications --volume <volumeId> --region <region>

2.    Run the diskmgmt.msc command to open an RDP session for the instance in Disk Manager view. For Action, choose Refresh.

3.    Open the context (right-click) menu for the Volume, and choose Extend Volume.

4.    Choose Next, Next, Finish.

5.    To confirm that the task is complete, run the following command:

aws ec2 describe-volumes --volume <volumeId>