VM::EC...chment(3pm)
β¨ VM::EC2::BlockDevice::Attachment β the manual page, but make it cute β¨
okay so bestie, you're looking at VM::EC2::BlockDevice::Attachment(3pm), and honestly? it's giving "little object, big job." let's get into it π
πΈ NAME πΈ
VM::EC2::BlockDevice::Attachment β the whole entire object that describes an EBS volume being attached to an instance. that's it, that's the vibe π
π¦ SYNOPSIS π¦
here's how you actually use it, no gatekeeping:
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
look at you go. main character energy fr fr β¨
π DESCRIPTION π
so this object's whole purpose is describing the attachment of an Amazon EBS volume to an instance. lowkey iconic. it gets returned to you by VM::EC2::Volume->attachment(), so you don't have to go hunting for it π«Ά
π METHODS π
these are the methods this object supports, and yes you're gonna want all of them:
volumeIdβ the ID of the volume. the whole point.instanceIdβ the ID of the instance.statusβ the attachment state, and it's one of"attaching","attached","detaching","detached".attachTimeβ a timestamp for when the volume got attached.deleteOnTerminationβ true if the EBS volume is gonna get deleted when its attached instance terminates. careful though bestie: this is a Perl true, not the string"true". not me being pedantic, it genuinely matters π
the deleteOnTermination method is slightly more sophisticated than what the standard AWS API hands you, because it returns the CURRENT deleteOnTermination flag for the attachment β which might have been changed by VM::EC2->modify_instance_attributes(). so it's not stale, it's fresh. periodt.
you can also change the deleteOnTermination state by passing a boolean argument to the method:
$attachment->deleteOnTermination(1);
and on top of all that, this class serves up several convenience functions:
π§ $instance = $attachment->instance
hands you back the VM::EC2::Instance that corresponds to this attachment.
π $volume = $attachment->volume
hands you back the VM::EC2::Volume object that corresponds to this attachment.
π $device = $attachment->deviceName
this one's an alias for device(), there so it stays compatible with the VM::EC2::BlockDevice::Mapping call.
π $result = $attachment->deleteOnTermination($boolean)
changes the deleteOnTermination flag on this attachment. yes, same name as the getter β she's versatile π
β $status = $attachment->current_status
refreshes the info in the object and then returns status().
π₯ $attachment->refresh
calls AWS to refresh the attachment information. go get the tea straight from the source.
π STRING OVERLOADING π
when you use this object in a string context, it interpolates into a string of the format "volumeId=>instanceId". cute little combo, honestly.
π SEE ALSO π
VM::EC2VM::EC2::GenericVM::EC2::InstanceVM::EC2::Volume
iykyk π
π AUTHOR π
Lincoln Stein <lincoln.stein@gmail.com>.
Copyright (c) 2011 Ontario Institute for Cancer Research
This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.
okay so this next bit is important, don't skip it: the license stuff is real and you should actually readLICENSEandDISCLAIMER.txt. no cap. π
and that's the whole page bestie π this was perl v5.38.2, dated 2024-08-10, and you read the manual page for VM::EC2::BlockDevice::Attachment(3pm). slay, go attach some volumes responsibly β¨π¦
π¦ where this page comes from
- debian trixie: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu resolute: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu stonking: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms