VM::EC...T::ami(3pm)
π VM::EC2::REST::ami π
okay so bestie, this is the Perl user-contributed manual page for VM::EC2::REST::ami, and it is literally your all-access pass to Amazon Machine Images. AMIs. The little golden snapshots of entire computers. Obsessed. πΌοΈβ¨
π NAME π
VM::EC2::REST::ami β Fetch and manipulate Amazon Machine Images π¦
πΈ SYNOPSIS πΈ
use VM::EC2 ':standard';
π METHODS π
These are methods that allow you to fetch and manipulate Amazon Machine Images. that's it, that's the whole job description, and it ate. π
Implemented:
CopyImageCreateImageDeregisterImageDescribeImageAttributeDescribeImagesModifyImageAttributeRegisterImageResetImageAttribute
Unimplemented:
- (none) β not a single one, zero crumbs left behind, we cleared the whole plate π₯
π EC2 AMAZON MACHINE IMAGES π
The methods in this section allow you to query and manipulate Amazon machine images (AMIs). See VM::EC2::Image. π
π« @i = $ec2->describe_images(@image_ids) π«
@i = $ec2->describe_images(@image_ids)
@i = $ec2->describe_images(-image_id=>\@id,-executable_by=>$id, -owner=>$id,
-filter=>\%filters)
Return a series of VM::EC2::Image objects, each describing an AMI. Optional arguments, in a cute little list for u:
-image_idβ The id of the image, either a string scalar or an arrayref.-executable_byβ Filter by images executable by the indicated user account, or one of the aliases"self"or"all".-ownerβ Filter by owner account number or one of the aliases"self","aws-marketplace","amazon"or"all".-filterβ Tags and other filters to apply
If there are no other arguments, you may omit the -filter argument name and call describe_images() with a single hashref consisting of the search filters you wish to apply. lowkey a glow-up for your typing fingers. β¨
The full list of image filters can be found at: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html
π§ $image = $ec2->create_image(-instance_id=>$id,-name=>$name,%other_args) π§
Create an image from an EBS-backed instance and return a VM::EC2::Image object. The instance must be in the "stopped" or "running" state. In the latter case, Amazon will stop the instance, create the image, and then restart it unless the -no_reboot argument is provided. (yes, it will just. do that. to your instance. no cap. π)
Arguments:
-instance_idβ ID of the instance to create an image from. (required)-nameβ Name for the image that will be created. (required)-descriptionβ Description of the new image.-no_rebootβ If true, don't reboot the instance.-block_device_mappingβ Block device mapping as a scalar or array ref. Seerun_instances()for the syntax.-block_devicesβ Alias of the above
π $image = $ec2->register_image(-name=>$name,%other_args) π
Register an image, creating an AMI. This can be used to create an AMI from a S3-backed instance-store bundle, or to create an AMI from a snapshot of an EBS-backed root volume. two paths, one icon. π
Required arguments:
-nameβ Name for the image that will be created.
Arguments required for an EBS-backed image:
-root_device_nameβ The root device name, e.g./dev/sda1-block_device_mappingβ The block device mapping strings, including the snapshot ID for the root volume. This can be either a scalar string or an arrayref. Seerun_instances()for a description of the syntax.-block_devicesβ Alias of the above.
Arguments required for an instance-store image:
-image_locationβ Full path to the AMI manifest in Amazon S3 storage.
Common optional arguments:
-descriptionβ Description of the AMI-architectureβ Architecture of the image ("i386"or"x86_64")-kernel_idβ ID of the kernel to use-ramdisk_idβ ID of the RAM disk to use-virtualization_typeβ Type of virtualization ("paravirtual"or"hvm"). Default is"paravirtual"-sriov_net_supportβ Set to"simple"to enable enhanced networking for the AMI
While you do not have to specify the kernel ID, it is strongly recommended that you do so. Otherwise the kernel will have to be specified for run_instances(). bestie, just give it the kernel id, do future-you a favour. π
Note: Immediately after registering the image you can add tags to it and use modify_image_attribute to change launch permissions, etc.
π«Ά $result = $ec2->deregister_image($image_id) π«Ά
Deletes the registered image and returns true if successful. bye girl, it was real. π
π @data = $ec2->describe_image_attribute($image_id,$attribute) π
This method returns image attributes. Only one attribute can be retrieved at a time. The following is the list of attributes that can be retrieved:
description -- scalar
kernel -- scalar
ramdisk -- scalar
launchPermission -- list of scalar
productCodes -- array
blockDeviceMapping -- list of hashref
sriovNetSupport -- scalar
All of these values can be retrieved more conveniently from the VM::EC2::Image object returned from describe_images(), so there is no attempt to parse the results of this call into Perl objects. In particular, 'blockDeviceMapping' is returned as a raw hashrefs (there also seems to be an AWS bug that causes fetching this attribute to return an AuthFailure error). yeah. an actual bug. we said what we said. π
Please see the VM::EC2::Image launchPermissions() and blockDeviceMapping() methods for more convenient ways to get this data.
π
$boolean = $ec2->modify_image_attribute($image_id,-$attribute_name=>$value) π
This method changes image attributes. The first argument is the image ID, and this is followed by the attribute name and the value to change it to. main character energy, rearranging your whole image's personality. β¨
The following is the list of attributes that can be set:
-launch_add_userβ scalar or arrayref of UserIds to grant launch permissions to-launch_add_groupβ scalar or arrayref of Groups to remove launch permissions from (only currently valid value is"all")-launch_remove_userβ scalar or arrayref of UserIds to remove from launch permissions-launch_remove_groupβ scalar or arrayref of Groups to remove from launch permissions-product_codeβ scalar or array of product codes to add-descriptionβ scalar new description
You can abbreviate the launch permission arguments to -add_user, -add_group, -remove_user, -remove_group, etc. short queen behaviour fr fr.
Only one attribute can be changed in a single request. one (1) thing. per request. that's the rule. π
For example:
$ec2->modify_image_attribute('ami-12345',-product_code=>['abcde','ghijk']);
The result code is true if the attribute was successfully modified, false otherwise. In the latter case, $ec2->error() will provide the error message. so check it, bestie. π«Ά
To make an image public, specify -launch_add_group=>'all':
$ec2->modify_image_attribute('i-12345',-launch_add_group=>'all');
Also see VM::EC2::Image for shortcut methods. For example:
$image->add_authorized_users(1234567,999991);
π¦ $boolean = $ec2->reset_image_attribute($image_id,$attribute_name) π¦
This method resets an attribute of the given snapshot to its default value. The valid attributes are:
launchPermission
π $image = $ec2->copy_image(...) π
$image = $ec2->copy_image(-source_region => $src, -source_image_id => $id,
-name => $name, -description => $desc, -client_token
=> $token)
Initiates the copy of an AMI from the specified source region to the region in which the API call is executed. long-distance relationship but make it infrastructure. βοΈπ
Required arguments:
-source_regionβ The ID of the AWS region that contains the AMI to be copied (source).-source_image_idβ The ID of the Amazon EC2 AMI to copy.
Optional arguments:
-nameβ The name of the new EC2 AMI in the destination region.-descriptionβ A description of the new AMI in the destination region.-client_tokenβ Unique, case-sensitive identifier you provide to ensure idempotency of the request.
Returns a VM::EC2::Image object on success;
π SEE ALSO π
VM::EC2
π 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.
and that's the whole page, bestie!! ππ this manual is VM::EC...T::ami(3pm) from perl v5.38.2, dated 2024-08-10, and honestly? iconic. go copy an AMI. slay. πβ¨
π¦ 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