VM::EC2::BlockDevice::Attachment3pm
Object describing the attachment of an ebs volume to an instance
Usage
use VM::EC2;$ec2 = VM::EC2->new(...);$volume = $ec2->describe_volumes(-volume_id=>'vol-12345');$attachment = $ec2->attachment;$volId = $attachment->volumeId;$device = $attachment->device;$instanceId = $attachment->instanceId;$status = $attachment->status;$time = $attachment->attachTime;$delete = $attachment->deleteOnTermination;$attachment->deleteOnTermination(1); # change delete flag
Overview
This object is used to describe the attachment of an Amazon EBS volume to an instance. It is returned by VM::EC2::Volume->attachment().
Methods
The following object methods are supported:
volumeId -- ID of the volume.instanceId -- ID of the instancestatus -- Attachment state, one of "attaching", "attached","detaching", "detached".attachTime -- Timestamp for when volume was attacheddeleteOnTermination -- True if the EBS volume will be deleted when itsattached instance terminates. Note that this is aPerl true, and not the string "true".
The deleteOnTermination method is slightly more sophisticated than the result from the standard AWS API because it returns the CURRENT deleteOnTermination flag for the attachment, which might have been changed by VM::EC2->modify_instance_attributes(). You may also change the deleteOnTermination state by passing a boolean argument to the method:
$attachment->deleteOnTermination(1);
In addition, this class provides several convenience functions:
$instance = $attachment->instance
Returns the VM::EC2::Instance corresponding to this attachment.
$volume = $attachment->volume
Returns the VM::EC2::Volume object corresponding to this attachment.
$device = $attachment->deviceName
Alias for device() to be compatible with VM::EC2::BlockDevice::Mapping call.
$result = $attachment->deleteOnTermination($boolean)
Change the deleteOnTermination flag on this attachment.
$status = $attachment->current_status
Refreshes the information in the object and returns status().
$attachment->refresh
Calls AWS to refresh the attachment information.
String overloading
When used in a string context, this object will interpolate into a string of the format "volumeId=>instanceId".
Releases
6 releases since Debian 8 (Jessie); the text changed 3 times.