class AWS::EC2::Attachment

volume.delete
sleep 1 until volume.status == :available
end
attachment.delete(:force => true)
volume.attachments.each do |attachment|
@example Remove all attachments from a volume and then delete it
sleep 1 until attachment.status != :attaching
attachment = volume.attach_to(ec2.instances, “/dev/sdf”)
:availability_zone => “us-west-2a”)
volume = ec2.volumes.create(:size => 15,
@example Create an empty 15GiB volume and attach it to an instance
Represents an attachment of an Amazon EBS volume to an instance.

def delete options = {}

Options Hash: (**options)
  • :force (Boolean) -- Forces detachment if the
def delete options = {}
  client.detach_volume(options.merge(resource_options))
end

def describe_attachment

def describe_attachment
  find_attachment(describe_call)
end

def describe_call

def describe_call
  client.describe_volumes(:volume_ids => [self.volume.id])
end

def exists?

Returns:
  • (Boolean) - Returns true if the attachment exists.
def exists?
  !describe_attachment.nil?
end

def find_attachment(resp)

def find_attachment(resp)
  vol = resp.volume_index[volume.id] and
  attachments = vol.attachment_set and
  attachments.find do |att|
    att.instance_id == instance.id &&
      att.volume_id == volume.id &&
      att.device == device
  end
end

def initialize volume, instance, device, options = {}

Other tags:
    Api: - private
def initialize volume, instance, device, options = {}
  @volume = volume
  @instance = instance
  @device = device
  super
end

def resource_identifiers

def resource_identifiers
  [
    [:volume_id, volume.id],
    [:instance_id, instance.id],
    [:device, device],
  ]
end