1VM::EC2::REST::ami(3) User Contributed Perl DocumentationVM::EC2::REST::ami(3)
2
3
4

NAME VM::EC2::REST::ami

SYNOPSIS

7       use VM::EC2 ':standard';
8

METHODS

10       These are methods that allow you to fetch and manipulate Amazon Machine
11       Images.
12
13       Implemented:
14        CopyImage
15        CreateImage
16        DeregisterImage
17        DescribeImageAttribute
18        DescribeImages
19        ModifyImageAttribute
20        RegisterImage
21        ResetImageAttribute
22
23       Unimplemented:
24        (none)
25

EC2 AMAZON MACHINE IMAGES

27       The methods in this section allow you to query and manipulate Amazon
28       machine images (AMIs). See VM::EC2::Image.
29
30   @i = $ec2->describe_images(@image_ids)
31   @i = $ec2->describe_images(-image_id=>\@id,-executable_by=>$id,
32       -owner=>$id, -filter=>\%filters)
33       Return a series of VM::EC2::Image objects, each describing an AMI.
34       Optional arguments:
35
36        -image_id        The id of the image, either a string scalar or an
37                         arrayref.
38
39        -executable_by   Filter by images executable by the indicated user account, or
40                           one of the aliases "self" or "all".
41
42        -owner           Filter by owner account number or one of the aliases "self",
43                           "aws-marketplace", "amazon" or "all".
44
45        -filter          Tags and other filters to apply
46
47       If there are no other arguments, you may omit the -filter argument name
48       and call describe_images() with a single hashref consisting of the
49       search filters you wish to apply.
50
51       The full list of image filters can be found at:
52       http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html
53
54   $image = $ec2->create_image(-instance_id=>$id,-name=>$name,%other_args)
55       Create an image from an EBS-backed instance and return a VM::EC2::Image
56       object. The instance must be in the "stopped" or "running" state. In
57       the latter case, Amazon will stop the instance, create the image, and
58       then restart it unless the -no_reboot argument is provided.
59
60       Arguments:
61
62        -instance_id    ID of the instance to create an image from. (required)
63        -name           Name for the image that will be created. (required)
64        -description    Description of the new image.
65        -no_reboot      If true, don't reboot the instance.
66        -block_device_mapping
67                        Block device mapping as a scalar or array ref. See
68                         run_instances() for the syntax.
69        -block_devices  Alias of the above
70
71   $image = $ec2->register_image(-name=>$name,%other_args)
72       Register an image, creating an AMI. This can be used to create an AMI
73       from a S3-backed instance-store bundle, or to create an AMI from a
74       snapshot of an EBS-backed root volume.
75
76       Required arguments:
77
78        -name                 Name for the image that will be created.
79
80       Arguments required for an EBS-backed image:
81
82        -root_device_name     The root device name, e.g. /dev/sda1
83        -block_device_mapping The block device mapping strings, including the
84                              snapshot ID for the root volume. This can
85                              be either a scalar string or an arrayref.
86                              See run_instances() for a description of the
87                              syntax.
88        -block_devices        Alias of the above.
89
90       Arguments required for an instance-store image:
91
92        -image_location      Full path to the AMI manifest in Amazon S3 storage.
93
94       Common optional arguments:
95
96        -description         Description of the AMI
97        -architecture        Architecture of the image ("i386" or "x86_64")
98        -kernel_id           ID of the kernel to use
99        -ramdisk_id          ID of the RAM disk to use
100        -virtualization_type Type of virtualization ("paravirtual" or "hvm")
101                             Default is "paravirtual"
102        -sriov_net_support   Set to "simple" to enable enhanced networking for the AMI
103
104       While you do not have to specify the kernel ID, it is strongly
105       recommended that you do so. Otherwise the kernel will have to be
106       specified for run_instances().
107
108       Note: Immediately after registering the image you can add tags to it
109       and use modify_image_attribute to change launch permissions, etc.
110
111   $result = $ec2->deregister_image($image_id)
112       Deletes the registered image and returns true if successful.
113
114   @data = $ec2->describe_image_attribute($image_id,$attribute)
115       This method returns image attributes. Only one attribute can be
116       retrieved at a time. The following is the list of attributes that can
117       be retrieved:
118
119        description            -- scalar
120        kernel                 -- scalar
121        ramdisk                -- scalar
122        launchPermission       -- list of scalar
123        productCodes           -- array
124        blockDeviceMapping     -- list of hashref
125        sriovNetSupport        -- scalar
126
127       All of these values can be retrieved more conveniently from the
128       VM::EC2::Image object returned from describe_images(), so there is no
129       attempt to parse the results of this call into Perl objects. In
130       particular, 'blockDeviceMapping' is returned as a raw hashrefs (there
131       also seems to be an AWS bug that causes fetching this attribute to
132       return an AuthFailure error).
133
134       Please see the VM::EC2::Image launchPermissions() and
135       blockDeviceMapping() methods for more convenient ways to get this data.
136
137   $boolean = $ec2->modify_image_attribute($image_id,-$attribute_name=>$value)
138       This method changes image attributes. The first argument is the image
139       ID, and this is followed by the attribute name and the value to change
140       it to.
141
142       The following is the list of attributes that can be set:
143
144        -launch_add_user         -- scalar or arrayref of UserIds to grant launch permissions to
145        -launch_add_group        -- scalar or arrayref of Groups to remove launch permissions from
146                                      (only currently valid value is "all")
147        -launch_remove_user      -- scalar or arrayref of UserIds to remove from launch permissions
148        -launch_remove_group     -- scalar or arrayref of Groups to remove from launch permissions
149        -product_code            -- scalar or array of product codes to add
150        -description             -- scalar new description
151
152       You can abbreviate the launch permission arguments to -add_user,
153       -add_group, -remove_user, -remove_group, etc.
154
155       Only one attribute can be changed in a single request.
156
157       For example:
158
159         $ec2->modify_image_attribute('ami-12345',-product_code=>['abcde','ghijk']);
160
161       The result code is true if the attribute was successfully modified,
162       false otherwise. In the latter case, $ec2->error() will provide the
163       error message.
164
165       To make an image public, specify -launch_add_group=>'all':
166
167         $ec2->modify_image_attribute('i-12345',-launch_add_group=>'all');
168
169       Also see VM::EC2::Image for shortcut methods. For example:
170
171        $image->add_authorized_users(1234567,999991);
172
173   $boolean = $ec2->reset_image_attribute($image_id,$attribute_name)
174       This method resets an attribute of the given snapshot to its default
175       value. The valid attributes are:
176
177        launchPermission
178
179   $image = $ec2->copy_image(-source_region   => $src, -source_image_id =>
180       $id, -name            => $name, -description     => $desc,
181       -client_token    => $token)
182       Initiates the copy of an AMI from the specified source region to the
183       region in which the API call is executed.
184
185       Required arguments:
186
187        -source_region       -- The ID of the AWS region that contains the AMI to be
188                                copied (source).
189
190        -source_image_id     -- The ID of the Amazon EC2 AMI to copy.
191
192       Optional arguments:
193
194        -name                -- The name of the new EC2 AMI in the destination region.
195
196        -description         -- A description of the new AMI in the destination region.
197
198        -client_token        -- Unique, case-sensitive identifier you provide to ensure
199                                idempotency of the request.
200
201       Returns a VM::EC2::Image object on success;
202

SEE ALSO

204       VM::EC2
205

AUTHOR

207       Lincoln Stein <lincoln.stein@gmail.com>.
208
209       Copyright (c) 2011 Ontario Institute for Cancer Research
210
211       This package and its accompanying libraries is free software; you can
212       redistribute it and/or modify it under the terms of the GPL (either
213       version 1, or at your option, any later version) or the Artistic
214       License 2.0.  Refer to LICENSE for the full license text. In addition,
215       please see DISCLAIMER.txt for disclaimers of warranty.
216
217
218
219perl v5.30.0                      2019-07-26             VM::EC2::REST::ami(3)
Impressum