Class | AWS::EC2::Attachment |
In: |
lib/aws/ec2/attachment.rb
|
Parent: | Resource |
Represents an attachment of an Amazon EBS volume to an instance.
@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
Detaches the volume from its instance. @option options [Boolean] :force Forces detachment if the
previous detachment attempt did not occur cleanly (logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance will not have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.