View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

Release Management/Amazon Use Cases

Contents

Introduction.

As some day or the other we (RM) all have either shifted our existing EC2 instances or oncreased the space etc. etc. So decided to write a wiki/refernce for later use.

Use Cases

There are several schenarios which we have dealt with in past:

etc. etc.

Steps For Use Cases

Solution:

ec2-create-volume -s SIZE -z ZONE
example: ec2-create-volume -s 50 -z eu-west-1b 
ec2-attach-volume VOLUME -i INSTANCE -d DEVICE
example: ec2-attach-volume vol-b4cc21d0 -i i-b079f3c0 -d /dev/sdh
mkfs.ext3 DEVICE
mount DEVICE DIRECTORY
example: mkfs.ext3 /dev/sdh
example: mount /dev/sdh /mnt/ebs
rsync -avHx FROM_DIRECTORY TO_DIRECTORY
example: rsync -avHx /srv/ /mnt/ebs
umount /dev/sdh
ec2-detach-volume VOLUME
example: ec2-detach-volume vol-b4cc21d0
ec2-create-snapshot -d DESCRIPTION VOLUME_ID
example: ec2-create-snapshot -d "Creating new Instance for Test" vol-b4cc21d0
ec2-register -s SNAPSHOT_ID --kernel AKI --description DESCRIPTION --architecture ARCH -n NAME --root-device-name ROOT_DEVICE
example: ec2-register -s snap-fc803495 --kernel aki-966a41e2 --description "New AMI for Testing" --architecture i386 --root-device-name /dev/sda1
ec2-run-instances -k $KEYPAIR-EU -t INSTANCE_TYPE -g $SECURITY_GROUP $AMI
example: ec2-run-instances -k harpreet-eu -t c1.medium -g tmp ami-f8795280
Solution:

EC2 CLI Commands

All these commands are written keeping in mind that your ENV variables are set (EC2 key/userID/api-tools etc)

A) Creating a volume.

ec2-create-volume -s SIZE -z ZONE
example: ec2-create-volume -s 50 -z eu-west-1b 
ec2-create-volume --snapshot SNAPSHOT -s SIZE -z ZONE
example: ec2-create-volume --snapshot snap-fc803495 -s 50 -z eu-west-1b

B) Creating a snapshot of existing volume.

ec2-create-snapshot -d DESCRIPTION VOLUME_ID
example: ec2-create-snapshot -d "Creating new Instance for Test" vol-b4cc21d0

C) Registering an AMI from a snapshot.

ec2-register -s SNAPSHOT_ID --kernel AKI --description DESCRIPTION --architecture ARCH -n NAME --root-device-name ROOT_DEVICE
example: ec2-register -s snap-fc803495 --kernel aki-966a41e2 --description "New AMI for Testing" --architecture i386 --root-device-name /dev/sda1

D) Booting an instance from an AMI.

ec2-run-instances -k $KEYPAIR-EU -t INSTANCE_TYPE -g $SECURITY_GROUP $AMI
example: ec2-run-instances -k harpreet-eu -t c1.medium -g tmp ami-f8795280

E) Detaching a volume from an instance.

ec2-detach-volume VOLUME
example: ec2-detach-volume vol-b4cc21d0

F) Attaching a volume to an instance.

ec2-attach-volume VOLUME -i INSTANCE -d DEVICE
example: ec2-attach-volume vol-b4cc21d0 -i i-b079f3c0 -d /dev/sdh

G) Stopping an instance.

ec2-stop-instances INSTANCE
example: ec2-stop-instances i-b079f3c0

H) Rebooting an instance.

ec2-reboot-instances INSTANCE
example: ec2-reboot-instances i-b079f3c0

I) Terminating an instance.

ec2-terminate-instances INSTANCE
example: ec2-terminate-instances i-b079f3c0 

J)

example:

Retrieved from "http://wiki.openbravo.com/wiki/Release_Management/Amazon_Use_Cases"

This page has been accessed 1,669 times. This page was last modified on 30 November 2010, at 10:40. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.