How do I expand the Amazon EBS root volume of my Amazon EC2 Windows instance?
I ran out of space on my Amazon Elastic Compute Cloud (EC2) Windows instance. I want to dynamically expand the Amazon Elastic Block Store (Amazon EBS) volumes of my Windows instances.
"I ran out of space on my Amazon Elastic Compute Cloud (EC2) Windows instance. I want to dynamically expand the Amazon Elastic Block Store (Amazon EBS) volumes of my Windows instances.ResolutionAn Amazon EC2 Windows instance created from an Amazon Machine Image (AMI) has a default 30 GB gp2 (General Purpose SSD) Amazon EBS root volume. To expand the disk space of a Windows instance, follow these steps.Use the Amazon EC2 console or AWS Command Line Interface (AWS CLI) to expand the EBS volume that's attached to a Windows instance.Use Disk Management or PowerShell to extend the volume's file system at the operating system level.Expand the EBS volumeNote: By default, Windows root volumes are the master boot record (MBR). You can extend the volumes up to 2 TB.Using the earlier Amazon EC2 console1.    Open the Amazon EC2 console, and then choose Instances from the navigation pane.2.    Select the instance that you want to expand. From the Description tab, choose the Block devices name. Then, choose the EBS ID.3.    Select the volume. From Actions, choose Modify Volume.4.    In the Size field, enter the Size and IOPS based on the volume type.5.    Choose Modify, and then choose Yes. Refresh the console page. In the Description tab, the State shows the progress of Optimization for successful modification calls. After the volume enters the Optimizing state, proceed to the instructions for extending the volume's file system.Using the new Amazon EC2 console1.    Open the Amazon EC2 console, and then choose Instances from the navigation pane.2.    Select the instance. From the Storage tab, choose the EBS Volume ID.3.    Select the volume. From Actions, choose Modify Volume.4.    In the Size field, enter the Size and IOPS based on the volume type.5.    Choose Modify, and then choose Yes. Refresh the console page. In the Description tab, the State shows the progress of Optimization for successful modification calls. After the volume enters the Optimizing state, proceed to the instructions for extending the volume's file system.Using AWS CLINote: If you receive errors when running AWS CLI commands, make sure that you're using the most recent AWS CLI version.Use the modify-volume AWS CLI command to expand the EBS volume. Run a command similar to the example command here. Replace RegionName, VolumeId, NewSize, NewType, and NewIops with your values: aws ec2 modify-volume --region RegionName --volume-id VolumeId --size NewSize --volume-type NewType --iops NewIopsNote: To view the progress of your task, run the following command:aws ec2 describe-volumes-modifications --volume VolumeId --region RegionNameExtend the volume space at the operating system levelUsing Disk Management1.    Use Remote Desktop Protocol (RDP) to connect to your EC2 Windows instance.2.    Open a command prompt, and then run the diskmgmt.msc command to launch Disk Management. From Action, choose Refresh.3.    Open the context (right-click) menu for the Volume, and then choose Extend Volume.4.    Choose Next, Next, Finish.Repeat these steps for any additional volumes.Using PowerShell1.    Use RDP to connect to your EC2 Windows instance.2.    Run PowerShell as an administrator.3.    Run the Get-Partition command. PowerShell returns the corresponding partition number for each partition, the drive letter, offset, size, and type. Note the drive letter of the partition to extend.4.    Run the following command to rescan the disk:"rescan" | diskpart5.    Use the drive letter from step 3 to run the following command. Replace the YourDriveLetter with your values. PowerShell returns the minimum and maximum size of the partition allowed, in bytes.Get-PartitionSupportedSize -DriveLetter YourDriveLetter6.    To extend the partition to a specified amount, use the following command, entering the new size of the volume in place of NewSize. You can enter the new size in KB, MB, or GB. For example, if the earlier size is 30 GB and you want to extend by 2 GB, then the value for the new size is 32 GB.Resize-Partition -DriveLetter YourDriveLetter -Size NewSize7.    To extend the partition to the maximum available size, run the following command:Resize-Partition -DriveLetter YourDriveLetter -Size $(Get-PartitionSupportedSize -DriveLetter YourDriveLetter).SizeMaxFor more information, see Extend a Windows file system using PowerShell.Note: Before extending a file system that contains valuable data, it's best practice to create a snapshot of the volume. Use the snapshot to roll back your changes as needed. For more information, see Create Amazon EBS snapshots.Follow"