Skip to main content

image_attributes

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

Overview

Nameimage_attributes
TypeResource
Idaws.ec2.image_attributes

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
block_device_mappingsstringThe block device mapping entries.
boot_modestringThe boot mode.
deregistration_protectionstringIndicates whether deregistration protection is enabled for the AMI.
descriptionstringA description for the AMI.
image_idstringThe ID of 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 ID.
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.
launch_permissionsstringThe launch permissions.
product_codesstringThe product codes.
ramdisk_idstringThe RAM disk ID.
sriov_net_supportstringIndicates whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
tpm_supportstringIf the image is configured for NitroTPM support, the value is v2.0.
uefi_datastringBase64 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.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_image_attributeselectAttribute, ImageId, regionDryRunDescribes the specified attribute of the specified AMI. You can specify only one attribute at a time. 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.
modify_image_attributeupdateImageId, regionAttribute, Description, LaunchPermission, OperationType, ProductCode, UserGroup, UserId, Value, OrganizationArn, OrganizationalUnitArn, ImdsSupport, DryRunModifies the specified attribute of the specified AMI. You can specify only one attribute at a time. To specify the attribute, you can use the Attribute parameter, or one of the following parameters: Description, ImdsSupport, or LaunchPermission. Images with an Amazon Web Services Marketplace product code cannot be made public. To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.

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 AMI attribute. Note: The blockDeviceMapping attribute is deprecated. Using this attribute returns the Client.AuthFailure error. To get information about the block device mappings for an AMI, describe the image instead.
ImageIdstringThe ID of the AMI.
regionstringAWS region (default: us-east-1)
AttributestringThe name of the attribute to modify. Valid values: description | imdsSupport | launchPermission
DescriptionobjectA new description for the 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.
ImdsSupportobjectSet 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. Do not use this parameter unless your AMI software supports IMDSv2. After you set the value to v2.0, you can't undo it. The only way to “reset” your AMI is to create a new AMI from the underlying snapshot.
LaunchPermissionobjectA new launch permission for the AMI.
OperationTypestringThe operation type. This parameter can be used only when the Attribute parameter is launchPermission.
OrganizationArnarrayThe Amazon Resource Name (ARN) of an organization. This parameter can be used only when the Attribute parameter is launchPermission.
OrganizationalUnitArnarrayThe Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the Attribute parameter is launchPermission.
ProductCodearrayNot supported.
UserGrouparrayThe user groups. This parameter can be used only when the Attribute parameter is launchPermission.
UserIdarrayThe Amazon Web Services account IDs. This parameter can be used only when the Attribute parameter is launchPermission.
ValuestringThe value of the attribute being modified. This parameter can be used only when the Attribute parameter is description or imdsSupport.

SELECT examples

Describes the specified attribute of the specified AMI. You can specify only one attribute at a time. 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
block_device_mappings,
boot_mode,
deregistration_protection,
description,
image_id,
imds_support,
kernel_id,
last_launched_time,
launch_permissions,
product_codes,
ramdisk_id,
sriov_net_support,
tpm_support,
uefi_data
FROM aws.ec2.image_attributes
WHERE Attribute = '{{ Attribute }}' -- required
AND ImageId = '{{ ImageId }}' -- required
AND region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
;

UPDATE examples

Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time. To specify the attribute, you can use the Attribute parameter, or one of the following parameters: Description, ImdsSupport, or LaunchPermission. Images with an Amazon Web Services Marketplace product code cannot be made public. To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.

UPDATE aws.ec2.image_attributes
SET
-- No updatable properties
WHERE
ImageId = '{{ ImageId }}' --required
AND region = '{{ region }}' --required
AND Attribute = '{{ Attribute}}'
AND Description = '{{ Description}}'
AND LaunchPermission = '{{ LaunchPermission}}'
AND OperationType = '{{ OperationType}}'
AND ProductCode = '{{ ProductCode}}'
AND UserGroup = '{{ UserGroup}}'
AND UserId = '{{ UserId}}'
AND Value = '{{ Value}}'
AND OrganizationArn = '{{ OrganizationArn}}'
AND OrganizationalUnitArn = '{{ OrganizationalUnitArn}}'
AND ImdsSupport = '{{ ImdsSupport}}'
AND DryRun = {{ DryRun}};