Amazon EBS

On January 23, 2010, in Amazon Cloud EC2 S3, CentOS, Fedora, Linux, Web Services, by phpsolutions

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/phpsolutions-data
# mount /dev/sdh /mnt/phpsolutions-data

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

Unmounting the Volume
# cd ~
# umount /mnt/phpsolutions-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 phpsolutions-data folder to new instance…

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

3 Responses to Amazon EBS

  1. Anonymous says:

    When I visit this website there’s new things and improved for me to learn from. Haha I’ve been in your source code several times to understand how you’re doing a bit of things so i could use them my site. Thanks! I can coach you on about methods to make money online.

  2. Anonymous says:

    Thank you for sharing superb informations. Your websiteis so cool.I will be in awe of the details that you’ve with this blog. It reveals how nicely you perceive this subject. Bookmarked this site, can come backfor extra articles. You, my pal, ROCK! I found this can be the info I already searched all over the place and just couldn?t come across. Exactly what a ideal website. I favor this web web site plus your website is without question considered one of my new favorite ones.I love this website given and contains given me some sort of dedication to succeed for a few purpose, so thanks

  3. Anonymous says:

    Kudos for posting such a useful weblog. Your site isn’t only informative but also very artistic too. There are typically very few those who can write low number of simple articles that creatively. Maintain the nice writing !!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.