RSS

Amazon EBS

23 Jan

Amazon Elastic Block Storage (EBS)

We can use Amazon EBS just like as the CD/DVD/Pen Drives on our PC/Laptops Servers for backup or data transfer…
EBS can attach to an EC2 instance, we can use EBS to save work files in it.. for it we have to mount it in the instance after backup we can unmount it, and detach it.
We can use the volume afterward by mounting it in another instance but different instances at the same time can not use same EBS volume.

Starting an Instance

# ec2-describe-images -o self -o amazon | grep machine
# ec2-add-keypair gsg-keypair (save this keypair for connecting instance via SSH)
# chmod 600 id_rsa-gsg-keypair ; ls -l id_rsa-gsg-keypair
# ec2-run-instances ami-235fba4a -k gsg-keypair
# ec2-describe-instances i-ae0bf0c7

Authorize ports to connect remotely…
# ec2-authorize default -p 22
# ec2-authorize default -p 80

Connect to instance
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com

Create the Volume
# ec2-create-volume –size 1 -z us-east-1c
Create this volume in same availability zone

# ec2-describe-volumes vol-4771e479

Attaching the Volume
# ec2-attach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda

Formatting the Volume
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com
# ls /dev
# yes | mkfs -t ext3 /dev/sda

Mounting the Volume
# mkdir /mnt/svnlabs-data
# mount /dev/sdh /mnt/svnlabs-data

Put a file on the volume
# vi /mnt/svnlabs-data/svnlabs.txt (put content here)

Unmounting the Volume
# cd ~
# umount /mnt/svnlabs-data

Detach the Volume
# ec2-detach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda

As we attach this volume to other instance we will get our svnlabs-data folder to new instance…

svnlabs will post some new articles on “Amazon Web Services” 😉 subscribe to svnlabs feeds

Advertisements
 
 

Tags: , , , , , , , , , , , , , , , ,

One response to “Amazon EBS

  1. blog.svnlabs.com

    October 11, 2010 at 6:07 pm

    Tank you. Greetings from the Speedy DNS

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: