image_attributes
Creates, updates, deletes, gets or lists an image_attributes resource.
Overview
| Name | image_attributes |
| Type | Resource |
| Id | aws.ec2.image_attributes |
Fields
The following fields are returned by SELECT queries:
- describe_image_attribute
| Name | Datatype | Description |
|---|---|---|
block_device_mappings | string | The block device mapping entries. |
boot_mode | string | The boot mode. |
deregistration_protection | string | Indicates whether deregistration protection is enabled for the AMI. |
description | string | A description for the AMI. |
image_id | string | The ID of the AMI. |
imds_support | string | If 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_id | string | The kernel ID. |
last_launched_time | string | The 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_permissions | string | The launch permissions. |
product_codes | string | The product codes. |
ramdisk_id | string | The RAM disk ID. |
sriov_net_support | string | Indicates whether enhanced networking with the Intel 82599 Virtual Function interface is enabled. |
tpm_support | string | If the image is configured for NitroTPM support, the value is v2.0. |
uefi_data | string | Base64 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_image_attribute | select | Attribute, ImageId, region | DryRun | 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. |
modify_image_attribute | update | ImageId, region | Attribute, Description, LaunchPermission, OperationType, ProductCode, UserGroup, UserId, Value, OrganizationArn, OrganizationalUnitArn, ImdsSupport, DryRun | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
Attribute | string | The 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. |
ImageId | string | The ID of the AMI. |
region | string | AWS region (default: us-east-1) |
Attribute | string | The name of the attribute to modify. Valid values: description | imdsSupport | launchPermission |
Description | object | A new description for the AMI. |
DryRun | boolean | Checks 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. |
ImdsSupport | object | Set 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. |
LaunchPermission | object | A new launch permission for the AMI. |
OperationType | string | The operation type. This parameter can be used only when the Attribute parameter is launchPermission. |
OrganizationArn | array | The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the Attribute parameter is launchPermission. |
OrganizationalUnitArn | array | The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the Attribute parameter is launchPermission. |
ProductCode | array | Not supported. |
UserGroup | array | The user groups. This parameter can be used only when the Attribute parameter is launchPermission. |
UserId | array | The Amazon Web Services account IDs. This parameter can be used only when the Attribute parameter is launchPermission. |
Value | string | The value of the attribute being modified. This parameter can be used only when the Attribute parameter is description or imdsSupport. |
SELECT examples
- describe_image_attribute
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
- modify_image_attribute
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}};