1VM::EC2::BlockDevice::MUaspeprinCgo(n3t)ributed Perl DocVuMm:e:nEtCa2t:i:oBnlockDevice::Mapping(3)
2
3
4
6 VM::EC2::BlockDevice::Mapping - Object describing an EC2 block device
7 attached to an instance
8
10 use VM::EC2;
11
12 $ec2 = VM::EC2->new(...);
13 $instance = $ec2->describe_instances(-instance_id=>'i-123456');
14 my @devices = $instance->blockDeviceMapping;
15 for my $dev (@devices) {
16 $dev = $dev->deviceName;
17 $volume_id = $dev->volumeId;
18 $status = $dev->status;
19 $atime = $dev->attachmentTime;
20 $delete = $dev->deleteOnTermination;
21 $volume = $dev->volume;
22 }
23
25 This object represents an Amazon block device associated with an
26 instance; it is returned by Instance->blockDeviceMapping().
27
28 Please see VM::EC2::Generic for methods shared by all VM::EC2 objects.
29
31 These object methods are supported:
32
33 deviceName -- Name of the device, such as /dev/sda1.
34 instance -- Instance object associated with this volume.
35 ebs -- A VM::EC2::BlockDevice::Mapping::EBS object
36 describing the characteristics of the attached
37 EBS volume
38
39 For your convenience, a number of the ebs() object's methods are passed
40 through:
41
42 volumeId -- ID of the volume.
43 status -- One of "attaching", "attached", "detaching", "detached"
44 attachTime -- Time this volume was attached
45 deleteOnTermination -- Whether the volume will be deleted when its attached
46 instance is deleted. Note that this will return perl true/false
47 vales, rather than the strings "true" "false".
48
49 The deleteOnTermination() method can be used to retrieve or modify this
50 flag:
51
52 # get current deleteOnTermination flag
53 my $current_flag = $dev->deleteOnTermination;
54
55 # if flag is true, then set it to false
56 if ($current_flag) { $dev->deleteOnTermination(0) }
57
58 In addition, the following convenience function is provided:
59
60 $volume = $dev->volume
61 This returns a VM::EC2::Volume object from which more information about
62 the volume, such as its size, can be derived.
63
65 When used in a string context, this object will be interpolated as the
66 deviceName.
67
69 VM::EC2 VM::EC2::Generic VM::EC2::BlockDevice
70 VM::EC2::BlockDevice::Attachment VM::EC2::BlockDevice::Mapping::EBS
71 VM::EC2::Volume
72
74 Lincoln Stein <lincoln.stein@gmail.com>.
75
76 Copyright (c) 2011 Ontario Institute for Cancer Research
77
78 This package and its accompanying libraries is free software; you can
79 redistribute it and/or modify it under the terms of the GPL (either
80 version 1, or at your option, any later version) or the Artistic
81 License 2.0. Refer to LICENSE for the full license text. In addition,
82 please see DISCLAIMER.txt for disclaimers of warranty.
83
84
85
86perl v5.34.0 2021-07-27 VM::EC2::BlockDevice::Mapping(3)