VM::EC...chment(3pm)

πŸ“¦
version 1.28 Β· 7 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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::EC2
  • VM::EC2::Generic
  • VM::EC2::Instance
  • VM::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 read LICENSE and DISCLAIMER.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