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

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

πŸ’Ύ 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/sda1 for 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 a VM::EC2::BlockDevice::EBS object.

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 between 100 and 4000. 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. read LICENSE and DISCLAIMER.txt fr 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