Skip to main content

images

Creates, updates, deletes, gets or lists an images resource.

Overview

Nameimages
TypeResource
Idaws.ec2.images

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
architecturestringThe architecture of the image.
block_device_mappingsstringAny block device mapping entries.
boot_modestringThe boot mode of the image. For more information, see Instance launch behavior with Amazon EC2 boot modes in the Amazon EC2 User Guide.
creation_datestringThe date and time the image was created.
deprecation_timestringThe date and time to deprecate the AMI, in UTC, in the following format: YYYY-MM-DDTHH:MM:SSZ. If you specified a value for seconds, Amazon EC2 rounds the seconds to the nearest minute.
deregistration_protectionstringIndicates whether deregistration protection is enabled for the AMI.
descriptionstringThe description of the AMI that was provided during image creation.
ena_supportbooleanSpecifies whether enhanced networking with ENA is enabled.
free_tier_eligiblebooleanIndicates whether the image is eligible for Amazon Web Services Free Tier. If true, the AMI is eligible for Free Tier and can be used to launch instances under the Free Tier limits. If false, the AMI is not eligible for Free Tier.
hypervisorstringThe hypervisor type of the image. Only xen is supported. ovm is not supported.
image_allowedbooleanIf true, the AMI satisfies the criteria for Allowed AMIs and can be discovered and used in the account. If false and Allowed AMIs is set to enabled, the AMI can't be discovered or used in the account. If false and Allowed AMIs is set to audit-mode, the AMI can be discovered and used in the account. For more information, see Control the discovery and use of AMIs in Amazon EC2 with Allowed AMIs in Amazon EC2 User Guide.
image_idstringThe ID of the AMI.
image_locationstringThe location of the AMI.
image_owner_aliasstringThe owner alias (amazon | aws-backup-vault | aws-marketplace).
image_typestringThe type of image.
image_watermarksstringThe watermarks attached to the AMI.
imds_supportstringIf v2.0, it indicates that IMDSv2 is specified in the AMI. Instances launched from this AMI will have HttpTokens automatically set to required so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, HttpPutResponseHopLimit is set to 2. For more information, see Configure the AMI in the Amazon EC2 User Guide.
kernel_idstringThe kernel associated with the image, if any. Only applicable for machine images.
last_launched_timestringThe date and time, in ISO 8601 date-time format, when the AMI was last used to launch an EC2 instance. When the AMI is used to launch an instance, there is a 24-hour delay before that usage is reported. lastLaunchedTime data is available starting April 2017.
namestringThe name of the AMI that was provided during image creation.
owner_idstringThe ID of the Amazon Web Services account that owns the image.
platformstringThis value is set to windows for Windows AMIs; otherwise, it is blank.
platform_detailsstringThe platform details associated with the billing code of the AMI. For more information, see Understand AMI billing information in the Amazon EC2 User Guide.
product_codesstringAny product codes associated with the AMI.
publicbooleanIndicates whether the image has public launch permissions. The value is true if this image has public launch permissions or false if it has only implicit and explicit launch permissions.
public_ssm_parameter_namestringThe name of the public Systems Manager parameter that resolves to this AMI, under the aws/service/ namespace.
ramdisk_idstringThe RAM disk associated with the image, if any. Only applicable for machine images.
root_device_namestringThe device name of the root device volume (for example, /dev/sda1).
root_device_typestringThe type of root device used by the AMI. The AMI can use an Amazon EBS volume or an instance store volume.
source_image_idstringThe ID of the source AMI from which the AMI was created.
source_image_regionstringThe Region of the source AMI.
source_instance_idstringThe ID of the instance that the AMI was created from if the AMI was created using CreateImage. This field only appears if the AMI was created using CreateImage.
sriov_net_supportstringSpecifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
statestringThe current state of the AMI. If the state is available, the image is successfully registered and can be used to launch an instance.
state_reasonstringThe reason for the state change.
tagsstringAny tags assigned to the image.
tpm_supportstringIf the image is configured for NitroTPM support, the value is v2.0. For more information, see NitroTPM in the Amazon EC2 User Guide.
usage_operationstringThe operation of the Amazon EC2 instance and the billing code that is associated with the AMI. usageOperation corresponds to the lineitem/Operation column on your Amazon Web Services Cost and Usage Report and in the Amazon Web Services Price List API. You can view these fields on the Instances or AMIs pages in the Amazon EC2 console, or in the responses that are returned by the DescribeImages command in the Amazon EC2 API, or the describe-images command in the CLI.
virtualization_typestringThe type of virtualization of the AMI.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_imagesselectregionExecutableBy, ImageId, Owner, IncludeDeprecated, IncludeDisabled, MaxResults, NextToken, DryRun, FilterDescribes the specified images (AMIs, AKIs, and ARIs) available to you or all of the images available to you. The images available to you include public images, private images that you own, and private images owned by other Amazon Web Services accounts for which you have explicit launch permissions. Recently deregistered images appear in the returned results for a short interval and then return empty results. After all instances that reference a deregistered AMI are terminated, specifying the ID of the image will eventually return an error indicating that the AMI ID cannot be found. When Allowed AMIs is set to enabled, only allowed images are returned in the results, with the imageAllowed field set to true for each image. In audit-mode, the imageAllowed field is set to true for images that meet the account's Allowed AMIs criteria, and false for images that don't meet the criteria. For more information, see Allowed AMIs. The Amazon EC2 API follows an eventual consistency model. This means that the result of an API command you run that creates or modifies resources might not be immediately available to all subsequent commands you run. For guidance on how to manage eventual consistency, see Eventual consistency in the Amazon EC2 API in the Amazon EC2 Developer Guide. We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts. The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.
create_imageinsertInstanceId, regionTagSpecification, SnapshotLocation, DryRun, Name, Description, NoReboot, BlockDeviceMappingCreates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped. If you customized your instance with instance store volumes or Amazon EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes. The location of the source instance determines where you can create the snapshots of the AMI: If the source instance is in a Region, you must create the snapshots in the same Region as the instance. If the source instance is in a Local Zone, you can create the snapshots in the same Local Zone or in its parent Region. If the source instance is on an Outpost that supports local snapshots, you can create the snapshots on the same Outpost or in the parent Region of that Outpost. In this case, you must use the SnapshotLocation parameter to specify where to create the snapshots. For more information, see Create an Amazon EBS-backed AMI in the Amazon Elastic Compute Cloud User Guide.
register_imageinsertregionImageLocation, BillingProduct, BootMode, TpmSupport, UefiData, ImdsSupport, TagSpecification, DryRun, Name, Description, Architecture, KernelId, RamdiskId, RootDeviceName, BlockDeviceMapping, VirtualizationType, SriovNetSupport, EnaSupportRegisters an AMI. When you're creating an instance-store backed AMI, registering the AMI is the final step in the creation process. For more information about creating AMIs, see Create an AMI from a snapshot and Create an instance-store backed AMI in the Amazon EC2 User Guide. If needed, you can deregister an AMI at any time. Any modifications you make to an AMI backed by an instance store volume invalidates its registration. If you make changes to an image, deregister the previous image and register the new image. Register a snapshot of a root device volume You can use RegisterImage to create an Amazon EBS-backed Linux AMI from a snapshot of a root device volume. You specify the snapshot using a block device mapping. You can't set the encryption state of the volume using the block device mapping. If the snapshot is encrypted, or encryption by default is enabled, the root volume of an instance launched from the AMI is encrypted. For more information, see Create an AMI from a snapshot and Use encryption with EBS-backed AMIs in the Amazon EC2 User Guide. Amazon Web Services Marketplace product codes If any snapshots have Amazon Web Services Marketplace product codes, they are copied to the new AMI. In most cases, AMIs for Windows, RedHat, SUSE, and SQL Server require correct licensing information to be present on the AMI. For more information, see Understand AMI billing information in the Amazon EC2 User Guide. When creating an AMI from a snapshot, the RegisterImage operation derives the correct billing information from the snapshot's metadata, but this requires the appropriate metadata to be present. To verify if the correct billing information was applied, check the PlatformDetails field on the new AMI. If the field is empty or doesn't match the expected operating system code (for example, Windows, RedHat, SUSE, or SQL), the AMI creation was unsuccessful, and you should discard the AMI and instead create the AMI from an instance. For more information, see Create an AMI from an instance in the Amazon EC2 User Guide. If you purchase a Reserved Instance to apply to an On-Demand Instance that was launched from an AMI with a billing product code, make sure that the Reserved Instance has the matching billing product code. If you purchase a Reserved Instance without the matching billing product code, the Reserved Instance is not applied to the On-Demand Instance. For information about how to obtain the platform details and billing information of an AMI, see Understand AMI billing information in the Amazon EC2 User Guide.
attach_image_watermarkupdateImageId, WatermarkName, regionDryRunAttaches a watermark to a non-public AMI. The watermark is a structured identifier that automatically propagates to all derivative images created through CreateImage, and CopyImage. Only the AMI owner can attach watermarks. Watermarks cannot be added to public AMIs.
detach_image_watermarkupdateImageId, WatermarkKey, regionDryRunRemoves a watermark from the specified AMI. This is an idempotent operation. It succeeds even if the watermark does not exist on the image. Removing a watermark from an image does not affect derivative images that already carry the watermark. Only the AMI owner can detach watermarks.
deregister_imagedeleteImageId, regionDeleteAssociatedSnapshots, DryRunDeregisters the specified AMI. A deregistered AMI can't be used to launch new instances. If a deregistered EBS-backed AMI matches a Recycle Bin retention rule, it moves to the Recycle Bin for the specified retention period. It can be restored before its retention period expires, after which it is permanently deleted. If the deregistered AMI doesn't match a retention rule, it is permanently deleted immediately. For more information, see Recover deleted Amazon EBS snapshots and EBS-backed AMIs with Recycle Bin in the Amazon EBS User Guide. When deregistering an EBS-backed AMI, you can optionally delete its associated snapshots at the same time. However, if a snapshot is associated with multiple AMIs, it won't be deleted even if specified for deletion, although the AMI will still be deregistered. Deregistering an AMI does not delete the following: Instances already launched from the AMI. You'll continue to incur usage costs for the instances until you terminate them. For EBS-backed AMIs: Snapshots that are associated with multiple AMIs. You'll continue to incur snapshot storage costs. For instance store-backed AMIs: The files uploaded to Amazon S3 during AMI creation. You'll continue to incur S3 storage costs. For more information, see Deregister an Amazon EC2 AMI in the Amazon EC2 User Guide.
cancel_image_launch_permissionexecImageId, regionDryRunRemoves your Amazon Web Services account from the launch permissions for the specified AMI. For more information, see Cancel having an AMI shared with your Amazon Web Services account in the Amazon EC2 User Guide.
disable_fast_launchexecImageId, regionForce, DryRunDiscontinue Windows fast launch for a Windows AMI, and clean up existing pre-provisioned snapshots. After you disable Windows fast launch, the AMI uses the standard launch process for each new instance. Amazon EC2 must remove all pre-provisioned snapshots before you can enable Windows fast launch again. You can only change these settings for Windows AMIs that you own or that have been shared with you.
disable_image_block_public_accessexecregionDryRunDisables block public access for AMIs at the account level in the specified Amazon Web Services Region. This removes the block public access restriction from your account. With the restriction removed, you can publicly share your AMIs in the specified Amazon Web Services Region. For more information, see Block public access to your AMIs in the Amazon EC2 User Guide.
disable_image_deprecationexecImageId, regionDryRunCancels the deprecation of the specified AMI. For more information, see Deprecate an Amazon EC2 AMI in the Amazon EC2 User Guide.
disable_image_deregistration_protectionexecImageId, regionDryRunDisables deregistration protection for an AMI. When deregistration protection is disabled, the AMI can be deregistered. If you chose to include a 24-hour cooldown period when you enabled deregistration protection for the AMI, then, when you disable deregistration protection, you won’t immediately be able to deregister the AMI. For more information, see Protect an Amazon EC2 AMI from deregistration in the Amazon EC2 User Guide.
enable_fast_launchexecImageId, regionResourceType, SnapshotConfiguration, LaunchTemplate, MaxParallelLaunches, DryRunWhen you enable Windows fast launch for a Windows AMI, images are pre-provisioned, using snapshots to launch instances up to 65% faster. To create the optimized Windows image, Amazon EC2 launches an instance and runs through Sysprep steps, rebooting as required. Then it creates a set of reserved snapshots that are used for subsequent launches. The reserved snapshots are automatically replenished as they are used, depending on your settings for launch frequency. You can only change these settings for Windows AMIs that you own or that have been shared with you.
enable_image_block_public_accessexecImageBlockPublicAccessState, regionDryRunEnables block public access for AMIs at the account level in the specified Amazon Web Services Region. This prevents the public sharing of your AMIs. However, if you already have public AMIs, they will remain publicly available. The API can take up to 10 minutes to configure this setting. During this time, if you run GetImageBlockPublicAccessState, the response will be unblocked. When the API has completed the configuration, the response will be block-new-sharing. For more information, see Block public access to your AMIs in the Amazon EC2 User Guide.
enable_image_deprecationexecImageId, DeprecateAt, regionDryRunEnables deprecation of the specified AMI at the specified date and time. For more information, see Deprecate an AMI in the Amazon EC2 User Guide.
enable_image_deregistration_protectionexecImageId, regionWithCooldown, DryRunEnables deregistration protection for an AMI. When deregistration protection is enabled, the AMI can't be deregistered. To allow the AMI to be deregistered, you must first disable deregistration protection. For more information, see Protect an Amazon EC2 AMI from deregistration in the Amazon EC2 User Guide.
reset_image_attributeexecAttribute, ImageId, regionDryRunResets an attribute of an AMI to its default value.
restore_image_from_recycle_binexecImageId, regionDryRunRestores an AMI from the Recycle Bin. For more information, see Recover deleted Amazon EBS snapshots and EBS-back AMIs with Recycle Bin in the Amazon EC2 User Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
AttributestringThe attribute to reset (currently you can only reset the launch permission attribute).
DeprecateAtstring (date-time)The date and time to deprecate the AMI, in UTC, in the following format: YYYY-MM-DDTHH:MM:SSZ. If you specify a value for seconds, Amazon EC2 rounds the seconds to the nearest minute. You can’t specify a date in the past. The upper limit for DeprecateAt is 10 years from now, except for public AMIs, where the upper limit is 2 years from the creation date.
ImageBlockPublicAccessStatestringSpecify block-new-sharing to enable block public access for AMIs at the account level in the specified Region. This will block any attempt to publicly share your AMIs in the specified Region.
ImageIdstringThe ID of the AMI to restore.
InstanceIdstringThe ID of the instance.
WatermarkKeystringThe watermark key to remove, in accountId:watermarkName format (for example, 123456789012:approvedAmi).
WatermarkNamestringThe name for the watermark. Combined with the caller's account ID to form the WatermarkKey (accountId:watermarkName). Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)
regionstringAWS region (default: us-east-1)
ArchitecturestringThe architecture of the AMI. Default: For Amazon EBS-backed AMIs, i386. For instance store-backed AMIs, the architecture specified in the manifest file.
BillingProductarrayThe billing product codes. Your account must be authorized to specify billing product codes. If your account is not authorized to specify billing product codes, you can publish AMIs that include billable software and list them on the Amazon Web Services Marketplace. You must first register as a seller on the Amazon Web Services Marketplace. For more information, see Getting started as an Amazon Web Services Marketplace seller and AMI-based products in Amazon Web Services Marketplace in the Amazon Web Services Marketplace Seller Guide.
BlockDeviceMappingarrayThe block device mapping entries. If you specify an Amazon EBS volume using the ID of an Amazon EBS snapshot, you can't specify the encryption state of the volume. If you create an AMI on an Outpost, then all backing snapshots must be on the same Outpost or in the Region of that Outpost. AMIs on an Outpost that include local snapshots can be used to launch instances on the same Outpost only. For more information, Create AMIs from local snapshots in the Amazon EBS User Guide.
BootModestringThe boot mode of the AMI. A value of uefi-preferred indicates that the AMI supports both UEFI and Legacy BIOS. The operating system contained in the AMI must be configured to support the specified boot mode. For more information, see Instance launch behavior with Amazon EC2 boot modes in the Amazon EC2 User Guide.
DeleteAssociatedSnapshotsbooleanSpecifies whether to delete the snapshots associated with the AMI during deregistration. If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting. Default: The snapshots are not deleted.
DescriptionstringA description for your AMI.
DryRunbooleanChecks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
EnaSupportbooleanSet to true to enable enhanced networking with ENA for the AMI and any instances that you launch from the AMI. This option is supported only for HVM AMIs. Specifying this option with a PV AMI can make instances launched from the AMI unreachable.
ExecutableByarrayScopes the images by users with explicit launch permissions. Specify an Amazon Web Services account ID, self (the sender of the request), or all (public AMIs). If you specify an Amazon Web Services account ID that is not your own, only AMIs shared with that specific Amazon Web Services account ID are returned. However, AMIs that are shared with the account’s organization or organizational unit (OU) are not returned. If you specify self or your own Amazon Web Services account ID, AMIs shared with your account are returned. In addition, AMIs that are shared with the organization or OU of which you are member are also returned. If you specify all, all public AMIs are returned.
FilterarrayThe filters. architecture - The image architecture (i386 | x86_64 | arm64 | x86_64_mac | arm64_mac). block-device-mapping.delete-on-termination - A Boolean value that indicates whether the Amazon EBS volume is deleted on instance termination. block-device-mapping.device-name - The device name specified in the block device mapping (for example, /dev/sdh or xvdh). block-device-mapping.snapshot-id - The ID of the snapshot used for the Amazon EBS volume. block-device-mapping.volume-size - The volume size of the Amazon EBS volume, in GiB. block-device-mapping.volume-type - The volume type of the Amazon EBS volume (io1 | io2 | gp2 | gp3 | sc1 | st1 | standard). block-device-mapping.encrypted - A Boolean that indicates whether the Amazon EBS volume is encrypted. creation-date - The time when the image was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example, 2021-09-29T11:04:43.305Z. You can use a wildcard (), for example, 2021-09-29T, which matches an entire day. description - The description of the image (provided during image creation). ena-support - A Boolean that indicates whether enhanced networking with ENA is enabled. free-tier-eligible - A Boolean that indicates whether this image can be used under the Amazon Web Services Free Tier (true | false). hypervisor - The hypervisor type (ovm | xen). image-allowed - A Boolean that indicates whether the image meets the criteria specified for Allowed AMIs. image-id - The ID of the image. image-watermark.source-image-creation-time - The creation date of the source AMI, in the ISO 8601 format in the UTC time zone ( YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM ). You can use a wildcard (), for example, 2021-09-29T, which matches an entire day. image-watermark.source-image-id - The ID of the AMI to which the watermark was originally attached. image-watermark.source-image-region - The Region where the watermark was originally attached. image-watermark.watermark-creation-time - The date and time the watermark was attached to the AMI, in the ISO 8601 format in the UTC time zone ( YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM ). You can use a wildcard (), for example, 2021-09-29T, which matches an entire day. image-watermark.watermark-key - The watermark identifier, in accountId:watermarkName format (for example, 123456789012:approvedAmi). image-type - The image type (machine | kernel | ramdisk). is-public - A Boolean that indicates whether the image is public. kernel-id - The kernel ID. manifest-location - The location of the image manifest. name - The name of the AMI (provided during image creation). owner-alias - The owner alias (amazon | aws-backup-vault | aws-marketplace). The valid aliases are defined in an Amazon-maintained list. This is not the Amazon Web Services account alias that can be set using the IAM console. We recommend that you use the Owner request parameter instead of this filter. owner-id - The Amazon Web Services account ID of the owner. We recommend that you use the Owner request parameter instead of this filter. platform - The platform. The only supported value is windows. product-code - The product code. product-code.type - The type of the product code (marketplace). public-ssm-parameter-name - The name of a public Systems Manager parameter associated with the AMI. The parameter must be in a trusted Amazon Web Services namespace under aws/service/. Returns all AMIs that have ever been associated with the parameter, including previous versions. ramdisk-id - The RAM disk ID. root-device-name - The device name of the root device volume (for example, /dev/sda1). root-device-type - The type of the root device volume (ebs | instance-store). source-image-id - The ID of the source AMI from which the AMI was created. source-image-region - The Region of the source AMI. source-instance-id - The ID of the instance that the AMI was created from if the AMI was created using CreateImage. This filter is applicable only if the AMI was created using CreateImage. state - The state of the image (available | pending | failed). state-reason-code - The reason code for the state change. state-reason-message - The message for the state change. sriov-net-support - A value of simple indicates that enhanced networking with the Intel 82599 VF interface is enabled. tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value. tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value. virtualization-type - The virtualization type (paravirtual | hvm).
ForcebooleanForces the image settings to turn off Windows fast launch for your Windows AMI. This parameter overrides any errors that are encountered while cleaning up resources in your account.
ImageIdarrayThe image IDs. Default: Describes all images available to you.
ImageLocationstringThe full path to your AMI manifest in Amazon S3 storage. The specified bucket must have the aws-exec-read canned access control list (ACL) to ensure that it can be accessed by Amazon EC2. For more information, see Canned ACL in the Amazon S3 Service Developer Guide.
ImdsSupportstringSet to v2.0 to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will have HttpTokens automatically set to required so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, HttpPutResponseHopLimit is set to 2. For more information, see Configure the AMI in the Amazon EC2 User Guide. If you set the value to v2.0, make sure that your AMI software can support IMDSv2.
IncludeDeprecatedbooleanSpecifies whether to include deprecated AMIs. Default: No deprecated AMIs are included in the response. If you are the AMI owner, all deprecated AMIs appear in the response regardless of what you specify for this parameter.
IncludeDisabledbooleanSpecifies whether to include disabled AMIs. Default: No disabled AMIs are included in the response.
KernelIdstringThe ID of the kernel.
LaunchTemplateobjectThe launch template to use when launching Windows instances from pre-provisioned snapshots. Launch template parameters can include either the name or ID of the launch template, but not both.
MaxParallelLaunchesintegerThe maximum number of instances that Amazon EC2 can launch at the same time to create pre-provisioned snapshots for Windows fast launch. Value must be 6 or greater.
MaxResultsintegerThe maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.
NamestringA name for your AMI. Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)
NextTokenstringThe token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
NoRebootbooleanIndicates whether or not the instance should be automatically rebooted before creating the image. Specify one of the following values: true - The instance is not rebooted before creating the image. This creates crash-consistent snapshots that include only the data that has been written to the volumes at the time the snapshots are created. Buffered data and data in memory that has not yet been written to the volumes is not included in the snapshots. false - The instance is rebooted before creating the image. This ensures that all buffered data and data in memory is written to the volumes before the snapshots are created. Default: false
OwnerarrayScopes the results to images with the specified owners. You can specify a combination of Amazon Web Services account IDs, self, amazon, aws-backup-vault, and aws-marketplace. If you omit this parameter, the results include all images for which you have launch permissions, regardless of ownership.
RamdiskIdstringThe ID of the RAM disk.
ResourceTypestringThe type of resource to use for pre-provisioning the AMI for Windows fast launch. Supported values include: snapshot, which is the default value.
RootDeviceNamestringThe device name of the root device volume (for example, /dev/sda1).
SnapshotConfigurationobjectConfiguration settings for creating and managing the snapshots that are used for pre-provisioning the AMI for Windows fast launch. The associated ResourceType must be snapshot.
SnapshotLocationstringOnly supported for instances in Local Zones and for instances on Outposts that support local snapshots. If the source instance is not in one of these locations, omit this parameter. The Amazon S3 location where the snapshots will be stored. To create local snapshots in the same Local Zone or on the same Outpost as the source instance, specify local. To create regional snapshots in the parent Region of the Local Zone or Outpost, specify regional. If the source instance is in a Local Zone and you omit this parameter, regional snapshots are created in the parent Region of the Local Zone. If the source instance is on an Outpost that supports local snapshots, this parameter is required. If you omit it, the request fails with an InvalidParameterValue error. Default: regional (for instances in Local Zones only)
SriovNetSupportstringSet to simple to enable enhanced networking with the Intel 82599 Virtual Function interface for the AMI and any instances that you launch from the AMI. There is no way to disable sriovNetSupport at this time. This option is supported only for HVM AMIs. Specifying this option with a PV AMI can make instances launched from the AMI unreachable.
TagSpecificationarrayThe tags to apply to the AMI. To tag the AMI, the value for ResourceType must be image. If you specify another value for ResourceType, the request fails. To tag an AMI after it has been registered, see CreateTags.
TpmSupportstringSet to v2.0 to enable Trusted Platform Module (TPM) support. For more information, see NitroTPM in the Amazon EC2 User Guide.
UefiDatastringBase64 representation of the non-volatile UEFI variable store. To retrieve the UEFI data, use the GetInstanceUefiData command. You can inspect and modify the UEFI data by using the python-uefivars tool on GitHub. For more information, see UEFI Secure Boot for Amazon EC2 instances in the Amazon EC2 User Guide.
VirtualizationTypestringThe type of virtualization (hvm | paravirtual). Default: paravirtual
WithCooldownbooleanIf true, enforces deregistration protection for 24 hours after deregistration protection is disabled.

SELECT examples

Describes the specified images (AMIs, AKIs, and ARIs) available to you or all of the images available to you. The images available to you include public images, private images that you own, and private images owned by other Amazon Web Services accounts for which you have explicit launch permissions. Recently deregistered images appear in the returned results for a short interval and then return empty results. After all instances that reference a deregistered AMI are terminated, specifying the ID of the image will eventually return an error indicating that the AMI ID cannot be found. When Allowed AMIs is set to enabled, only allowed images are returned in the results, with the imageAllowed field set to true for each image. In audit-mode, the imageAllowed field is set to true for images that meet the account's Allowed AMIs criteria, and false for images that don't meet the criteria. For more information, see Allowed AMIs. The Amazon EC2 API follows an eventual consistency model. This means that the result of an API command you run that creates or modifies resources might not be immediately available to all subsequent commands you run. For guidance on how to manage eventual consistency, see Eventual consistency in the Amazon EC2 API in the Amazon EC2 Developer Guide. We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts. The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.

SELECT
architecture,
block_device_mappings,
boot_mode,
creation_date,
deprecation_time,
deregistration_protection,
description,
ena_support,
free_tier_eligible,
hypervisor,
image_allowed,
image_id,
image_location,
image_owner_alias,
image_type,
image_watermarks,
imds_support,
kernel_id,
last_launched_time,
name,
owner_id,
platform,
platform_details,
product_codes,
public,
public_ssm_parameter_name,
ramdisk_id,
root_device_name,
root_device_type,
source_image_id,
source_image_region,
source_instance_id,
sriov_net_support,
state,
state_reason,
tags,
tpm_support,
usage_operation,
virtualization_type
FROM aws.ec2.images
WHERE region = '{{ region }}' -- required
AND ExecutableBy = '{{ ExecutableBy }}'
AND ImageId = '{{ ImageId }}'
AND Owner = '{{ Owner }}'
AND IncludeDeprecated = '{{ IncludeDeprecated }}'
AND IncludeDisabled = '{{ IncludeDisabled }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
AND DryRun = '{{ DryRun }}'
AND Filter = '{{ Filter }}'
;

INSERT examples

Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped. If you customized your instance with instance store volumes or Amazon EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes. The location of the source instance determines where you can create the snapshots of the AMI: If the source instance is in a Region, you must create the snapshots in the same Region as the instance. If the source instance is in a Local Zone, you can create the snapshots in the same Local Zone or in its parent Region. If the source instance is on an Outpost that supports local snapshots, you can create the snapshots on the same Outpost or in the parent Region of that Outpost. In this case, you must use the SnapshotLocation parameter to specify where to create the snapshots. For more information, see Create an Amazon EBS-backed AMI in the Amazon Elastic Compute Cloud User Guide.

INSERT INTO aws.ec2.images (
InstanceId,
region,
TagSpecification,
SnapshotLocation,
DryRun,
Name,
Description,
NoReboot,
BlockDeviceMapping
)
SELECT
'{{ InstanceId }}',
'{{ region }}',
'{{ TagSpecification }}',
'{{ SnapshotLocation }}',
'{{ DryRun }}',
'{{ Name }}',
'{{ Description }}',
'{{ NoReboot }}',
'{{ BlockDeviceMapping }}'
RETURNING
image_id
;

UPDATE examples

Attaches a watermark to a non-public AMI. The watermark is a structured identifier that automatically propagates to all derivative images created through CreateImage, and CopyImage. Only the AMI owner can attach watermarks. Watermarks cannot be added to public AMIs.

UPDATE aws.ec2.images
SET
-- No updatable properties
WHERE
ImageId = '{{ ImageId }}' --required
AND WatermarkName = '{{ WatermarkName }}' --required
AND region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
RETURNING
watermark_key;

DELETE examples

Deregisters the specified AMI. A deregistered AMI can't be used to launch new instances. If a deregistered EBS-backed AMI matches a Recycle Bin retention rule, it moves to the Recycle Bin for the specified retention period. It can be restored before its retention period expires, after which it is permanently deleted. If the deregistered AMI doesn't match a retention rule, it is permanently deleted immediately. For more information, see Recover deleted Amazon EBS snapshots and EBS-backed AMIs with Recycle Bin in the Amazon EBS User Guide. When deregistering an EBS-backed AMI, you can optionally delete its associated snapshots at the same time. However, if a snapshot is associated with multiple AMIs, it won't be deleted even if specified for deletion, although the AMI will still be deregistered. Deregistering an AMI does not delete the following: Instances already launched from the AMI. You'll continue to incur usage costs for the instances until you terminate them. For EBS-backed AMIs: Snapshots that are associated with multiple AMIs. You'll continue to incur snapshot storage costs. For instance store-backed AMIs: The files uploaded to Amazon S3 during AMI creation. You'll continue to incur S3 storage costs. For more information, see Deregister an Amazon EC2 AMI in the Amazon EC2 User Guide.

DELETE FROM aws.ec2.images
WHERE ImageId = '{{ ImageId }}' --required
AND region = '{{ region }}' --required
AND DeleteAssociatedSnapshots = '{{ DeleteAssociatedSnapshots }}'
AND DryRun = '{{ DryRun }}'
;

Lifecycle Methods

Removes your Amazon Web Services account from the launch permissions for the specified AMI. For more information, see Cancel having an AMI shared with your Amazon Web Services account in the Amazon EC2 User Guide.

EXEC aws.ec2.images.cancel_image_launch_permission
@ImageId='{{ ImageId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;