Creating and mounting an EBS volume to a Windows Amazon EC2 Instance

Yan Cui

I help clients go faster for less using serverless technologies.

This article is brought to you by

Is your CI build step taking too long? Try Depot for free today and experience up to 40x faster build speed!

Unlock faster CI for FREE

If you’re reading this post you probably already know about Amazon Elastic Block Store, aka Amazon EBS, one of the many services provided by the Amazon Web Services (AWS) ecosystem.

An EBS volume can range from 1GB to 1TB and can be mounted to an Amazon EC2 instance as a device, each EBS volume can be mounted to one instance but multiple volumes can be mounted to the same instance. To mount an EBS volume to an instance you have to first log into the AWS Management Console and follow a few simple steps.

Creating a new volume

1. Once inside the AWS Management Console, click the Volumes link under Elastic Block Store in the Navigation panel:image

2. Click the ‘Create Volume‘ button:


3. In the pop-up form, choose the size of the EBS volume you want to create and select the availability zone (remember, the EBS volume needs to be in the same availability zone as the instance it needs to be attached to):


Click “Create” to create a new EBS volume.

Attaching an EBS Volume to an Instance

1. Once the EBS volume is created and its status changed to ‘available’, select it, and click the “Attach Volume” button:


2. In the following pop-up, choose the instance you want to attach the volume:


Mount the EBS Volume as a drive

1. Now that the EBS volume is attached to the instance, remote connect to the instance, go to Start –> Run, and enter “diskmgmt.msc” to start the Disk Management tool:


2. In the Disk Management tool, right click on the new disk, which is “Offline” right now and bring it “Online“:


3. The disk then needs to be initialized, right click again and select “Initialize Disk“:


4. Choose whether to initialize the disk with MBR or GPT:


5. You’re almost there! Right click on the unallocated space in the initialized disk and create a “New Simple Volume“:


and follow the steps in the wizard.

6. A 10GB volume will probably take 5 ~ 10 mins to format, and once it’s done you’ll be able to see the drive:



Parting thoughts…

As mentioned in Membase’s documentation here, when using an Amazon EC2 instance as a Membase cache server you can use an EBS volume to alleviate the risk of losing your data when an instance fails because the EBS volume can be attached to another instance to effectively restore the node.

Another fun fact about EBS and Amazon EC2 is that Windows 2008 instances are backed and run directly from an EBS volume because of the sheer size of the images themselves! Which is why for every Windows Server 2008 instance you are running you’ll find a 30GB EBS volume attached to that instance, and every AMI you create will have a matching EBS snapshot. And the implication of this is that, if you’re using a Windows instance to run Membase, you won’t need to create additional EBS volumes to store the Membase sqlite files. BUT, there’s a catch, if you terminate the instance manually or through a scaling down event the EBS volume will be deleted too, so be sure to take this into consideration when deriving your strategy for deploying and scaling your Membase cache clusters.

Whenever you’re ready, here are 4 ways I can help you:

  1. Production-Ready Serverless: Join 20+ AWS Heroes & Community Builders and 1000+ other students in levelling up your serverless game. This is your one-stop shop for quickly levelling up your serverless skills.
  2. Do you want to know how to test serverless architectures with a fast dev & test loop? Check out my latest course, Testing Serverless Architectures and learn the smart way to test serverless.
  3. I help clients launch product ideas, improve their development processes and upskill their teams. If you’d like to work together, then let’s get in touch.
  4. Join my community on Discord, ask questions, and join the discussion on all things AWS and Serverless.

12 thoughts on “Creating and mounting an EBS volume to a Windows Amazon EC2 Instance”

  1. You can set the instance to not lose the volume
    By default, the root device volume for an AMI backed by Amazon EBS is deleted when the instance terminates. If you’ve made changes to the root device volume, but haven’t yet made a snapshot of the volume with your changes, you’ll be unhappy if the instance suddenly terminates and the root volume with your changes is lost. Use the DeleteOnTermination flag for a running instance so its root volume doesn’t get deleted. You can’t currently do this in the AWS Management Console; you must use the command line tools. You can verify the change in the console, however.

    ec2-describe-instances i-xxxxx –v



    ec2-modify-instance-attribute i-xxxxxxx -b /dev/sda1=vol-xxxxxxx:false –v



  2. Hi Allan,

    Thanks for pointing that option out to me, for some reason it’s not included in Amazon’s documentation, will test it out!


  3. Looks good but is it possible to have the Windows instance boot from the EBS instead of just attaching it.

  4. Hi Chris,

    Windows instance all boot from an attached EBS, if I remember correctly it’s to do with the size of the image required for the Windows instances (30GB) which was either too big or not-feasible for the instance store.

    You can boot from a standard AMI supplied by Amazon, make your changes – install services, apply patches, etc. – then create a new AMI out of the modified instance and use the new AMI with your auto-scaler, etc.

  5. Hi,

    I am in trouble. I had amazon ec2 windows instance. Amazon pause the instance after taking the snap shot. In that instance, i had critical data. I want to restore that data. I restored the snapshot in a volume. Then i created the new instance. After that i attached the restored volume with the instance. Using RDP, i logged in into the system and mount the disk which was appeared after attaching the volume.

    I want to get the old critical data. Now, problem is; windows is asking to format the disk.What should i do to get my old data.

    Can anyone help please?

  6. @Noor – If the data was on the instance that was paused, you should be able to simply start the paused instance and continue as you were before. Did you create the new instance from your snapshot (in which case it should have the data you had before) or were you trying to attach the snapshot to another instance as a volume?

  7. The paused instance was not available.

    I have successfully attach the snapshot to another new instance as volume. Using RDP, i logged in into the windows and mount the un-allocated new disk which was appeared as (D drive) after attaching the volume.

    But now problem is, when i try to access this new drive. It ask me to format the drive. My concern is that if i format the drive then i might lose the data, which i want to restore.

  8. I am able to restore many snapshot on windows 2008 server. But many of those appeared as unallocated drive & i can’t do anything with those. When i right click on those unallocated disks, i saw following options

    With few, i saw option “create simple volume”. This option leads to disk formating.
    With few, there isn’t any option accept properties.

    i am unable to understand the behaviour of snapshots.

    Can you help in this please?

  9. @Noor – I’ve not come across this type of behaviour myself, have you tried reaching out to AWS support via their support forum? Alternatively, if you need to get someone from AWS on the phone to sort it out, from past experience you should also be able to switch on their support package (bronze/silver/gold depending on urgency) when you need the support for and then switch the support package off to save on cost.

Leave a Comment

Your email address will not be published. Required fields are marked *