• Steelman’s Amazon Cloud Configuration

    Posted on April 27, 2010 by in Technology

    Amazon Cloud Configuration

    Data Survival of Instance Failure

    Amazon EBS is designed to allow you to attach any instance to a storage volume. In the event you experience an instance failure, your Amazon EBS volume automatically detaches with your data intact. You can then reattach the volume to a new instance and quickly recover.

    1. You are running an Amazon EC2 instance that is attached to an Amazon EBS volume, when your Amazon EC2 instance fails or is experiencing problems.
    2. To recover, you detach the Amazon EBS volume from your instance (if it has not already automatically detached), launch a new Amazon EC2 instance, and attach the Amazon EBS volume to the new instance.
    3. In the unlikely event the Amazon EBS volume fails, you can create a new Amazon EBS volume based on the most recent snapshot of your failed volume.

    Amazon EBS API Overview

    To configure and use Amazon EBS, we provide eight new API functions. This section provides a brief overview of each function.

    API List

      • CreateVolume—Creates a new Amazon EBS volume using the specified size or creates a new volume based on a previously created snapshot.
      • DeleteVolume—Deletes the specified volume.

        This function does not delete any snapshots that were created from this volume.

      • DescribeVolumes—Describes all volumes, including size, source snapshot, Availability Zone, creation time, and status (available, in-use).
      • AttachVolume—Attaches the specified volume to a specified instance, exposing the volume using the specified device name.

        A volume can only be attached to a single instance at any time. The volume and instance must be in the same Availability Zone and the instance must be running.

      • DetachVolume—Detaches the specified volume from the instance to which it is attached.

        This operation does not delete the volume. The volume can be attached to another instance and will have the same data as when it was detached.

      • CreateSnapshot—Creates a snapshot of the volume you specify.

        Once created, you can use the snapshot to create volumes that contain exactly the same data as the original volume.

      • DeleteSnapshot—Deletes the specified snapshot.

        This function does not affect currently running Amazon EBS volumes, regardless of whether they were used to create the snapshot or were derived from the snapshot.

      • DescribeSnapshots—Describes all snapshots, including their source volume, snapshot initiation time, progress (percentage complete), and status (pending, completed).

      Creating Amazon EBS Volumes and Snapshots

      Creating an Amazon EBS Volume

      To use Amazon EBS, you first create a volume that can be attached to any Amazon EC2 instance within the same Availability Zone. This example creates an 800 GiB Amazon EBS volume.

      To create an Amazon EBS volume

      1. Enter the following command.

        PROMPT> ec2-create-volume –size 800 –zone us-east-1a

        Amazon EBS returns information about the volume similar to the following example.

        VOLUME vol-4d826724 800 us-east-1a available 2008-02-14T00:00:00+0000

      2. To check whether the volume is ready, use the following command.

        PROMPT> ec2-describe-volumes vol-4d826724

        Amazon EBS returns information about the volume similar to the following example.

        VOLUME vol-4d826724 800 us-east-1a available 2008-07-29T08:49:25+0000

      Attaching the Volume to an Instance

      This section describes how to attach a volume that you created to an instance.

      To attach an Amazon EBS volume

        • Enter the following command.

          PROMPT> ec2-attach-volume volume_id -i instance_id -d device

          Amazon EBS returns information similar to the following.

          ATTACHMENT volume_id instance_id device attaching date_time

        Example

        This example attaches volume vol-4d826724 to instance i-6058a509 in Linux and UNIX and exposes it as device /dev/sdh.

        PROMPT> ec2-attach-volume vol-4d826724 -i i-6058a509 -d /dev/sdh

        ATTACHMENT vol-4d826724 i-6058a509 /dev/sdh attaching 2008-02-14T00:15:00+0000

        This example attaches volume vol-4d826724 to instance i-6058a509 in Windows and exposes it as device xvdf.

        PROMPT> ec2-attach-volume vol-4d826724 -i i-6058a509 -d xvdf

        ATTACHMENT vol-4d826724 i-6058a509 xvdf attaching 2008-02-14T00:15:00+0000

        NoteDescribing Volumes and Instances

        After creating Amazon EBS volumes and attaching them to instances, you can list them using the DescribeVolumes and the DescribeInstances operations.

        DescribeVolumes returns the volume ID, capacity, status (in-use or available) and creation time of each volume. If the volume is attached, an attachment line shows the volume ID, the instance ID to which the volume is attached, the device name exposed to the instance, its status (attaching, attached, detaching, detached), and when it attached.

        DescribeInstances lists volumes that are attached to running instances.

        To describe volumes

        • Enter the following command.

          PROMPT> ec2-describe-volumes

          Amazon EBS returns information about all volumes that you own.

          VOLUME vol-4d826724 us-east-1a 800 in-use 2008-02-14T00:00:00+0000

          ATTACHMENT vol-4d826724 i-6058a509 /dev/sdh attached 2008-02-14T00:00:17+0000

          VOLUME vol-50957039 13 us-east-1a available 2008-02-091T00:00:00+0000

          VOLUME vol-6682670f 1 us-east-1a in-use 2008-02-11T12:00:00+0000

          ATTACHMENT vol-6682670f i-69a54000 /dev/sdh attached 2008-02-11T13:56:00+0000

        To describe instances

        • Enter the following command.

          PROMPT> ec2-describe-instances

          Amazon EBS returns information about all running instances and volumes attached to those instances.

          RESERVATION r-e112fc88 416161254515 default

          INSTANCE i-3b887c52 ami-3fd13456 ec2-67-202-27-216.compute-1.amazonaws.com domU-12-31-38-00-35-94.compute-1.internal

          running gsg-keypair 0 m1.small 2007-11-26T13:20:35+0000 windows vol-4d826724

          RESERVATION r-e612fc8f 416161254515 default

          INSTANCE i-21b63c22 ami-3fd13456 ec2-67-202-18-227.compute-1.amazonaws.com domU-12-31-38-00-39-28.compute-1.internal

          running gsg-keypair 0 m1.small 2007-11-26T13:21:51+0000 windows vol-6682670f

        Using an Amazon EBS Volume within an Instance

        Inside the instance, the Amazon EBS volume is exposed as a normal block device and can be formatted as any file system and mounted.

        Linux and UNIX

        This section describes how to make a volume available to the Linux and UNIX operating system.

        To create an ext3 file system on the Amazon EBS volume and mount it as /mnt/data-store

        1. Enter the following command.

          $ yes | mkfs -t ext3 /dev/sdh

        2. Enter the following command.

          $ mkdir /mnt/data-store

        3. Enter the following command.

          $ mount /dev/sdh /mnt/data-store

        Any data written to this file system is written to the Amazon EBS volume and is transparent to applications using the device.

        Using an Amazon EBS Volume within an Instance

        Inside the instance, the Amazon EBS volume is exposed as a normal block device and can be formatted as any file system and mounted.

        Linux and UNIX

        This section describes how to make a volume available to the Linux and UNIX operating system.

        To create an ext3 file system on the Amazon EBS volume and mount it as /mnt/data-store

        1. Enter the following command.

          $ yes | mkfs -t ext3 /dev/sdh

        2. Enter the following command.

          $ mkdir /mnt/data-store

        3. Enter the following command.

          $ mount /dev/sdh /mnt/data-store

        Any data written to this file system is written to the Amazon EBS volume and is transparent to applications using the device.

        For more information please contact Daniel Brody @ Steelman

          Reblog this post [with Zemanta]