Optimizing Your AWS EC2 Windows Instance: A Comprehensive Guide to Extending Root Volumes and Adding Extra Storage
Tags: aws, devops, opensource, cloud
Published: 2023-12-24 19:09:49

## Extending the root volume of an EC2 Windows instance and attaching an additional volume is a multi-step process. Here's a step-by-step guide to achieve this:

**Step 1: Launch an EC2 Windows Instance**

- Log in to the AWS Management Console.

![aws console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2y20q15fonsmosx6dkbr.png)

- Navigate to the EC2 Dashboard.

- Click "Launch Instance" to create a new EC2 instance.

- Choose a Windows AMI (Amazon Machine Image) and select an instance type.

- In the "Add Storage" section, configure the root volume size according to your requirements.

- Complete the instance launch wizard, including security group and key pair settings.

- Launch the instance.

![ec2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0uwle4057y0qk35pblli.png)

**Step 2: Connect to the EC2 Instance**

- Once the instance is running, right-click it in the EC2 Dashboard, and select "Connect."

![ec2-connect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/id9xelhqsq57mmg42xss.png)

- Follow the instructions to connect to the instance using Remote Desktop Protocol (RDP).

![remote-server-desktop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q96u7lsec5d6ya5a08q3.png)

**Step 3: Extend the Root Volume**

- Inside the EC2 Windows instance, open the "Disk Management" utility under Computer Management.

![Disk Management](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xfif7ih2ob16nju8hkph.png)

- Locate the root volume, which is typically labeled as "C:." and you can see current storage as 30 GB (We will try to extend this volume)

![drive C](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdegd8vuo3x4t4lxq4a4.png)

- Go to AWS console -> Volume -> Select volume -> Click on action -> 'Modify Volume' and change it to 40 GB

![volume](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqsq3j00707312onz2ap.png)

- Go to EC2 Windows instance, open the "Disk Management" utility under Computer Management.

_Note_: You can see in the snip as total 40 GB online out of which 10 GB Unallocated

![disk](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4byml2y69pj2gjcp258.png)

- Right-click on disk and choose 'Extend Volume'

**Validation:**
- You can see extended volume in below snip

![extended disk](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enrbutmzufwl7ulatsru.png)

![extended disk2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/si2oefg4nzlvwwkgdih7.png)


**Step 4: Attach an Additional EBS Volume**

- In the AWS Console, navigate to the EC2 Dashboard and click on "Volumes" in the left navigation pane.

![volume](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ppsfxw1mo42wxuhx6p8.png)

- Create a new EBS volume with the desired size (e.g., 30GB). Note the availability zone.

- Back in the EC2 Dashboard, stop the Windows instance to attach the new volume.

![stopped instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rngkpfv85rhw509sx45g.png)

- Go to Volume and select it and choose 'Attache Volume' from 'Action'

- Select instance ID & Create Volume

- Back in the EC2 Dashboard

- Start the instance.

- Connect to the instance using RDP.

- Open the "Disk Management" utility.

- You will see the new volume listed. Initialize it and format it as needed.

![extra volume](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kpfouom00uqacvcg3s1.png)

**Step 5: Validate the Configuration**

- In Windows Explorer, verify that the root volume (C:) has been extended with the additional space.

![file explore](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mch556keqdj9jlhzaqm6.png)

- Create and modify files on the extra volume to ensure it is functioning correctly.

- You can also check the disk sizes and available space in the "File Explorer" or use the "Get-Volume" PowerShell command.

**Big big congratulation for completing this hands on LAB**

_Don't forget to do cleanup of all these AWS services which can lead to extra charges_

Follow me on [Linkedin](https://www.linkedin.com/in/shamim-ansari7/) | [Twitter](https://twitter.com/shamim_faizi786) for more such contents and Check out my [Services](https://www.fiverr.com/s/WGVYqE)