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

If you’re read­ing this post you prob­a­bly already know about Ama­zon Elas­tic Block Store, aka Ama­zon EBS, one of the many ser­vices pro­vid­ed by the Ama­zon Web Ser­vices (AWS) ecosys­tem.

An EBS vol­ume can range from 1GB to 1TB and can be mount­ed to an Ama­zon EC2 instance as a device, each EBS vol­ume can be mount­ed to one instance but mul­ti­ple vol­umes can be mount­ed to the same instance. To mount an EBS vol­ume to an instance you have to first log into the AWS Man­age­ment Con­sole and fol­low a few sim­ple steps.

Creating a new volume

1. Once inside the AWS Man­age­ment Con­sole, click the Vol­umes link under Elas­tic Block Store in the Nav­i­ga­tion pan­el:image

2. Click the ‘Cre­ate Vol­ume’ but­ton:

image

3. In the pop-up form, choose the size of the EBS vol­ume you want to cre­ate and select the avail­abil­i­ty zone (remem­ber, the EBS vol­ume needs to be in the same avail­abil­i­ty zone as the instance it needs to be attached to):

image

Click “Cre­ate” to cre­ate a new EBS vol­ume.

Attaching an EBS Volume to an Instance

1. Once the EBS vol­ume is cre­at­ed and its sta­tus changed to ‘avail­able’, select it, and click the “Attach Vol­ume” but­ton:

image

2. In the fol­low­ing pop-up, choose the instance you want to attach the vol­ume:

image

Mount the EBS Volume as a drive

1. Now that the EBS vol­ume is attached to the instance, remote con­nect to the instance, go to Start –> Run, and enter “diskmgmt.msc” to start the Disk Man­age­ment tool:

image

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

image

3. The disk then needs to be ini­tial­ized, right click again and select “Ini­tial­ize Disk”:

image

4. Choose whether to ini­tial­ize the disk with MBR or GPT:

image

5. You’re almost there! Right click on the unal­lo­cat­ed space in the ini­tial­ized disk and cre­ate a “New Sim­ple Vol­ume”:

image

and fol­low the steps in the wiz­ard.

6. A 10GB vol­ume will prob­a­bly take 5 ~ 10 mins to for­mat, and once it’s done you’ll be able to see the dri­ve:

image

image

Parting thoughts…

As men­tioned in Membase’s doc­u­men­ta­tion here, when using an Ama­zon EC2 instance as a Mem­base cache serv­er you can use an EBS vol­ume to alle­vi­ate the risk of los­ing your data when an instance fails because the EBS vol­ume can be attached to anoth­er instance to effec­tive­ly restore the node.


Anoth­er fun fact about EBS and Ama­zon EC2 is that Win­dows 2008 instances are backed and run direct­ly from an EBS vol­ume because of the sheer size of the images them­selves! Which is why for every Win­dows Serv­er 2008 instance you are run­ning you’ll find a 30GB EBS vol­ume attached to that instance, and every AMI you cre­ate will have a match­ing EBS snap­shot. And the impli­ca­tion of this is that, if you’re using a Win­dows instance to run Mem­base, you won’t need to cre­ate addi­tion­al EBS vol­umes to store the Mem­base sqlite files. BUT, there’s a catch, if you ter­mi­nate the instance man­u­al­ly or through a scal­ing down event the EBS vol­ume will be delet­ed too, so be sure to take this into con­sid­er­a­tion when deriv­ing your strat­e­gy for deploy­ing and scal­ing your Mem­base cache clus­ters.