Class AWS::EC2::Volume
In: lib/aws/ec2/volume.rb
Parent: Resource

Represents an Amazon EBS volume.

@example Create an empty 15GiB volume and attach it to an instance

 volume = ec2.volumes.create(:size => 15,
                             :availability_zone => "us-east-1a")
 attachment = volume.attach_to(ec2.instances["i-123"], "/dev/sdf")
 sleep 1 until attachment.status != :attaching

@example Remove all attachments from a volume and then delete it

 volume.attachments.each do |attachment|
   attachment.delete(:force => true)
 end
 sleep 1 until volume.status == :available
 volume.delete

@attr_reader [Symbol] status The status of the volume.

  Possible values:

  * +:creating+
  * +:available+
  * +:in_use+
  * +:deleting+
  * +:deleted+
  * +:error+

@attr_reader [Integer] size The size of the volume in

  gigabytes.

@attr_reader [String] availability_zone_name Name of the

  Availability Zone in which the volume was created.

@attr_reader [Time] create_time The time at which the volume

  was created.

Methods

Included Modules

TaggedItem

External Aliases

status -> state

Attributes

id  [R]  @return [String] Returns the volume ID.

Public Class methods

Public Instance methods

attach(instance, device)

Alias for attach_to

Attaches the volume to an instance.

@param [Instance] instance The instance to which the volume

  attaches. The volume and instance must be within the same
  Availability Zone and the instance must be running.

@param [String] device How the device is exposed to the

  instance (e.g., /dev/sdh, or xvdh).

@return [Attachment] An object representing the attachment,

  which you can use to query the attachment status.

@return [AttachmentCollection] The collection of attachments

  that involve this volume.

@return [AvailabilityZone] Returns the Availability

  Zone in which the volume was created.

@return [Snapshot] A new snapshot created from the volume.

@param [String] description An optional description of the

  snapshot.  May be up to 255 characters in length.

Deletes the volume.

Detaches the volume from an instance.

@param [Instance] instance The instance to detach from. @param [String] device The device name. @param [Hash] options @option (see Attachment#delete) @return [Attachment] Returns the no-longer valid attachment.

@return [Boolean] True if the volume exists.

@return [Snapshot] Snapshot from which the volume was created

  (may be nil).

[Validate]