VM::EC...Device(3pm)
πΎ VM::EC2::BlockDevice β bestie's guide to block devices πΎ
ok so this is a page from the User Contributed Perl Documentation collection, and it's all about VM::EC2::BlockDevice, which is an object that describes how to construct an EC2 block device when you're launching an image. yes it's giving very specific, but it's ALSO giving very useful, so stay with me π«Ά
β¨ NAME β¨
VM::EC2::BlockDevice β the object that tells you how to build an EC2 block device when you launch an image. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
here's how you'd actually use it, bestie:
use VM::EC2;
$ec2 = VM::EC2->new(...);
$image = $ec2->describe_images(-image_id=>'ami-123456');
my @devices = $image->blockDeviceMapping;
for my $d (@devices) {
my $virtual_device = $d->deviceName;
my $snapshot_id = $d->snapshotId;
my $volume_size = $d->volumeSize;
my $delete = $d->deleteOnTermination;
}
look at that. clean. organized. main character energy fr fr π
π¦ DESCRIPTION π¦
so basically, this object represents an Amazon block device that's associated with an AMI. the info inside it gets used to create a new volume when that AMI gets launched. and you get this object back from VM::EC2->describe_images(). no cap.
also, for all the methods that every single VM::EC2 object shares, go check out VM::EC2::Generic. shared lore, yk? π
π METHODS π
here are the object methods that are supported, bestie β every single one, don't skip:
deviceNameβ the name of the device, like/dev/sda1for example.virtualNameβ the virtual device name, something like"ephemeral0".noDeviceβ true if there's no device associated. like, nothing there. empty. πebsβ the parameters used to automatically set up Amazon EBS volumes when an instance is booted. this one returns aVM::EC2::BlockDevice::EBSobject.
and because the author is a real one and wants your life to be easy, a bunch of the ebs() object's methods are passed straight through to you:
snapshotIdβ the ID of the snapshot used to create this EBS when an instance is launched from this image.volumeSizeβ the size of the EBS volume, in gigs.deleteOnTerminationβ whether this EBS will get deleted when the instance terminates.volumeTypeβ the volume type. it's one of"standard"or"io1".iopsβ the number of I/O operations per second that the volume supports. it's an integer between100and4000. only valid for volumes of type"io1"β so don't come for it if you're on"standard", ok? π
π STRING OVERLOADING π
when you use this object in a string context, it gets interpolated as this:
deviceName=snapshotId:volumeSize:deleteOnTermination:volumeType:iops
and listen, the :iops portion is only valid when the volumeType is "io1". periodt.
for example:
/dev/sdg=snap-12345:20:true:standard
and here's the cute part β this happens to be the exact same syntax used to specify block device mappings in run_instances(). so go see VM::EC2 for that. it's giving consistent. it's giving iconic. β¨
π₯ SEE ALSO π₯
go read these too, bestie, they're all connected:
VM::EC2 VM::EC2::Generic VM::EC2::BlockDevice VM::EC2::BlockDevice::Attachment VM::EC2::BlockDevice::EBS VM::EC2::Volume
π 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.
β οΈ real talk β that license bit is not a vibe, it's a legal thing. readLICENSEandDISCLAIMER.txtfr fr. no skipping. π
and that's the whole page, bestie!! πΈ this was documented as perl v5.38.2 on 2024-08-10. slay, go launch some instances π§π
π¦ 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