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

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.

Enjoy what you’re reading? Subscribe to my newsletter and get more content on AWS and serverless technologies delivered straight to your inbox.

Yan Cui

I’m an AWS Serverless Hero and the author of Production-Ready Serverless. I have run production workload at scale in AWS for nearly 10 years and I have been an architect or principal engineer with a variety of industries ranging from banking, e-commerce, sports streaming to mobile gaming. I currently work as an independent consultant focused on AWS and serverless.

You can contact me via Email, Twitter and LinkedIn.

Hire me.

Check out my new course, Complete Guide to AWS Step Functions.

In this course, we’ll cover everything you need to know to use AWS Step Functions service effectively. Including basic concepts, HTTP and event triggers, activities, design patterns and best practices.

Get Your Copy