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-east-1a”)
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
  (resp = describe_call and
   volume = resp.volume_index[self.volume.id] and
   attachments = volume.attachment_set and
   attachment = attachments.find do |att|
     att.instance_id == self.instance.id &&
       att.volume_id == self.volume.id &&
       att.device == self.device
   end) or nil
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 initialize volume, instance, device, options = {}

Other tags:
    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