VM::EC...Mapping(3pm)
πΈ VM::EC2::BlockDevice::Mapping β the 3pm manual page πΈ
okay bestie, pull up a chair, because today we're talking about VM::EC2::BlockDevice::Mapping β a Perl module straight outta the User Contributed Perl Documentation collection. yes, the docs are written by the community, and yes, they still ate. π
β¨ NAME β¨
VM::EC2::BlockDevice::Mapping β the object that describes an EC2 block device attached to an instance. it's literally the little guy that knows which volume is glued to which instance, no cap. π¦
π SYNOPSIS π
here's the vibe, in code:
use VM::EC2;
$ec2 = VM::EC2->new(...);
$instance = $ec2->describe_instances(-instance_id=>'i-123456');
my @devices = $instance->blockDeviceMapping;
for my $dev (@devices) {
$dev = $dev->deviceName;
$volume_id = $dev->volumeId;
$status = $dev->status;
$atime = $dev->attachmentTime;
$delete = $dev->deleteOnTermination;
$volume = $dev->volume;
}
look at that loop go. she's looping, she's grabbing device names, volume ids, statuses, attach times, delete flags, and the volume itself. main character energy fr fr. π
π DESCRIPTION π
So like, this object represents an Amazon block device associated with an instance. It gets returned by Instance->blockDeviceMapping(). That's the whole origin story. π
also!! if you wanna know about the methods that EVERY VM::EC2 object shares, go peek at VM::EC2::Generic. it's the shared lore. π
π«Ά METHODS π«Ά
these object methods are supported:
deviceNameβ the name of the device, such as/dev/sda1. πinstanceβ the Instance object associated with this volume.ebsβ aVM::EC2::BlockDevice::Mapping::EBSobject describing the characteristics of the attached EBS volume. she's the detail girlie of the group. β¨
π the pass-through methods (a.k.a. for your convenience) π
bestie, because the module loves you, a bunch of the ebs() object's methods get passed straight through:
volumeIdβ ID of the volume. πstatusβ one of"attaching","attached","detaching","detached". four states, four moods, we stan a full lifecycle. πattachTimeβ the time this volume was attached. β°deleteOnTerminationβ whether the volume will be deleted when its attached instance is deleted. heads up tho: note that this will return perl true/false vales, rather than the strings"true""false". (yes the original says "vales," and I am not gonna gaslight you by silently fixing it β we love a documented typo, it's iconic) π
π¦ the deleteOnTermination() situation π¦
okay so this method can be used to retrieve or modify this flag. she's flexible like that.
# get current deleteOnTermination flag
my $current_flag = $dev->deleteOnTermination;
# if flag is true, then set it to false
if ($current_flag) { $dev->deleteOnTermination(0) }
read it, then change it. read it, then change it. slay. π₯
πΈ in addition, the following convenience function is provided: πΈ
π $volume = $dev->volume π
This returns a VM::EC2::Volume object, from which more information about the volume β such as its size β can be derived. it's giving "ask the volume directly, she'll tell you everything." π
π STRING OVERLOADING π
when used in a string context, this object will be interpolated as the deviceName. so if you just shove her into a string, you get the device name. periodt. β¨
π SEE ALSO π
go read these next, bestie, they're all connected:
VM::EC2VM::EC2::GenericVM::EC2::BlockDeviceVM::EC2::BlockDevice::AttachmentVM::EC2::BlockDevice::Mapping::EBSVM::EC2::Volume
π π¦ π
π AUTHOR π
Lincoln Stein <lincoln.stein@gmail.com>. the legend himself. π
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. π«Ά
and that's the whole page, babe β documented under perl v5.38.2, dated 2024-08-10, filed away as VM::EC2::BlockDevice::Mapping in the 3pm section. go forth and map those block devices. mwah. π
πβ¨
π¦ 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