A collection of computer systems and programming tips that you may find useful.
 
Brought to you by Craic Computing LLC, a bioinformatics consulting company.

Tuesday, August 11, 2009

Creating and Attaching AWS EBS Volumes to an EC2 node

AWS Elastic Block Store (EBS) Volumes are arbitrary blocks of storage that can be mounted on EC2 nodes and used like regular filesystems. Here are the basic steps needed to set them up (and the associated gotchas to avoid).

1. Create a new EBS Volume using the AWS Management Console.
Know what size in GiB you want in advance and make sure you create it in the same Availability Zone as the EC2 node you want to attach it to.

2. Attach it to your EC2 instance
Do this from the Management Console. If you have more than one EC2 node running make sure you know the Instance ID, PLUS know which device you want to attach the Volume to. Your options are typically /dev/sdf, /dev/sdg, etc. Not sure what happens if you try to attach to a device that is already in use. It probably won't let you but I would rather just not go there...

Wait until the Console tells you the Volume is 'attached'. You might want to refresh the console to see this.

Now go to the EC2 node...

3. Create a Filesystem on the Volume
If (and ONLY if) this is a NEW Volume then you need to create a filesystem on it before you can do anything. Skip this step if the Volume has previously been mounted.

You can create different types of filesystem on the Volume. On linux the current recommended type is ext3. Here I am using /dev/sdh. Note that it asks if I want to use the entire device - Yes I do!
# mkfs -t ext3 /dev/sdh
mke2fs 1.40.4 (31-Dec-2007)
/dev/sdh is entire device, not just one partition!
Proceed anyway? (y,n) y
[...]
4. Create a mount point for the filesystem
Again, you may not need to do this if the EC2 node has previously mounted this Volume, but for a new setup you want to create a mount point under /mnt for the volume. For example:
# mkdir /mnt/myvolume
And then proceed to mount the Volume:
# mount /dev/sdh /mnt/myvolume
There should be no output from this command. Check that it is mounted with 'df' and then just 'cd' to it and start using the space.

5: To detach your Volume
First you need to un-mount it from your EC2 node while the node is running.
# umount /mnt/myvolume
Then you can detach it using the Management Console (and remember to Detach, not Delete!)
Only then should you shutdown your EC2 node, if you choose to do that.

6: Creating Snapshots of Volumes
You can create Snapshots of your Volume as backups or as a copy from which to clone other Volumes to attach to other nodes. (A given Volume can only be attached to one node at a time).
You can do this from the Management Console. You should do this on Volumes that are not attached to EC2 nodes so as to avoid anything being written to the Volume during Snapshot creation. You should do that but you can create a snapshot from a mounted Volume if you want to. How risky this is depends on what you are doing - never do this if it the Volume carries a live database, but it is OK if the Volume has a read-only dataset on it. Caveat emptor.

In their web pages, AWS talks about an EBS volume having higher performance than local disk. The impression I get from other blogs is that this is very variable and depends on what you use the disk for. I have not formed an opinion for my applications as yet.



 

15 comments:

w3bsmith said...

I wanted to add one more step to make it easier. On my instances I always make a change in my fstab (/etc/fstab) to have it mounted automatically on a reboot:

/dev/sdh /mnt/my_EBS_volume ext3 defaults 0 0

Then you can just do a:

mount /mnt/my_EBS_volume

paolooo said...
This comment has been removed by the author.
Karthika Shree said...

This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
AWS Training in Chennai

likitha said...

simply superb,mind blowing, i will share your blog to my friends also
AWS Online Training

Softlogicseo said...


And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
Advanced C C++ Training in Chennai |Best C C++ Training course in Chennai
Advanced linux Training in Chennai | Best linux Training in Chennai
Advanced Unix Training in Chennai | Best Unix Training in Chennai
Advanced uipath training in chennai | Best uipath training in chennai
Advanced Rprogramming Training in Chennai | Best Rprogramming Training in Chennai

Mithun said...

Great Post with lots of useful informations. Excellent blog very much interesting...
SAP Training in Chennai | AWS Training in Chennai | SAP Training | AWS Training

SAP Training said...

Great Explanation with lots of useful information about aws and great explanation in this blog.

AWS Training in Chennai | SAP Training in Chennai

ramya said...

I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
Aws training chennai | AWS course in chennai
Rpa training in chennai | RPA training course chennai
sas training in chennai | sas training class in chennai

Indhu said...

Very good blog which explains really well about Cloud technology.
SAP Training in Chennai
AWS Training in Chennai
Java Training in Chennai
AWS Exam Center in Chennai

Mithun said...

Excellent blog on AWS Concepts. Superb information.
AWS Exam Center in Chennai | AWS Training in Chennai | AWS Training Institute in Chennai

Manigandan said...

Awesome Cloud Computing Tips..
Hardware and Networking Training in Chennai
CCNA Training in Chennai
AWS Training in Chennai
SAP Training in Chennai
Software Testing Training in Chennai
Java Training in Chennai
QTP Training in Chennai
iOS Training in Chennai
Oracle Training in Chennai
Pearson Vue Exam Center in Chennai

Arvind Kumar said...

Such a very useful information!Thanks for sharing this useful information with us. Really great effort.
Artificial Intelligence Training institute in Bangalore
Artificial Intelligence Training institute in India
Artificial Intelligence Training course
Artificial Intelligence Training in Bangalore

SAP Academy said...

Nice blog post.
SAP Training in Chennai | SAP Training Institute in Chennai

Mithun said...

Wonderful Blogspot
AWS Training in Chennai
AWS Training Institutes in Chennai
AWS Training Center in Chennai
AWS Training Course in Chennai
AWS Training Class in Chennai
Best AWS Training in Chennai
AWS Training Institute in Chennai
AWS Certification in Chennai
AWS Classes in Chennai
AWS Training

Python said...

Thanks for sharing all the information with us all.
Data Science Online Training
Python Online Training

Archive of Tips