image_usage_reports
Creates, updates, deletes, gets or lists an image_usage_reports resource.
Overview
| Name | image_usage_reports |
| Type | Resource |
| Id | aws.ec2.image_usage_reports |
Fields
The following fields are returned by SELECT queries:
- describe_image_usage_reports
| Name | Datatype | Description |
|---|---|---|
account_ids | string | The IDs of the Amazon Web Services accounts that were specified when the report was created. |
creation_time | string | The date and time when the report was created. |
expiration_time | string | The date and time when Amazon EC2 will delete the report (30 days after the report was created). |
image_id | string | The ID of the image that was specified when the report was created. |
report_id | string | The ID of the report. |
resource_types | string | The resource types that were specified when the report was created. |
state | string | The current state of the report. Possible values: available - The report is available to view. pending - The report is being created and not available to view. error - The report could not be created. |
state_reason | string | Provides additional details when the report is in an error state. |
tags | string | Any tags assigned to the report. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_image_usage_reports | select | region | ImageId, ReportId, NextToken, Filter, DryRun, MaxResults | Describes the configuration and status of image usage reports, filtered by report IDs or image IDs. For more information, see View your AMI usage in the Amazon EC2 User Guide. |
create_image_usage_report | insert | ImageId, ResourceType, region | DryRun, AccountId, ClientToken, TagSpecification | Creates a report that shows how your image is used across other Amazon Web Services accounts. The report provides visibility into which accounts are using the specified image, and how many resources (EC2 instances or launch templates) are referencing it. For more information, see View your AMI usage in the Amazon EC2 User Guide. |
delete_image_usage_report | delete | ReportId, region | DryRun | Deletes the specified image usage report. For more information, see View your AMI usage 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.
| Name | Datatype | Description |
|---|---|---|
ImageId | string | The ID of the image to report on. |
ReportId | string | The ID of the report to delete. |
ResourceType | array | The resource types to include in the report. |
region | string | AWS region (default: us-east-1) |
AccountId | array | The Amazon Web Services account IDs to include in the report. To include all accounts, omit this parameter. |
ClientToken | string | A unique, case-sensitive identifier that you provide to ensure idempotency of the request. |
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. |
Filter | array | The filters. creation-time - The time when the report was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example, 2025-11-29T11:04:43.305Z. You can use a wildcard (), for example, 2025-11-29T, which matches an entire day. state - The state of the report (available | pending | error). 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. |
ImageId | array | The IDs of the images for filtering the reports. If specified, only reports containing these images are returned. |
MaxResults | integer | The 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. |
NextToken | string | The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request. |
ReportId | array | The IDs of the image usage reports. |
TagSpecification | array | The tags to apply to the report on creation. The ResourceType must be set to image-usage-report; any other value will cause the report creation to fail. To tag a report after it has been created, see CreateTags. |
SELECT examples
- describe_image_usage_reports
Describes the configuration and status of image usage reports, filtered by report IDs or image IDs. For more information, see View your AMI usage in the Amazon EC2 User Guide.
SELECT
account_ids,
creation_time,
expiration_time,
image_id,
report_id,
resource_types,
state,
state_reason,
tags
FROM aws.ec2.image_usage_reports
WHERE region = '{{ region }}' -- required
AND ImageId = '{{ ImageId }}'
AND ReportId = '{{ ReportId }}'
AND NextToken = '{{ NextToken }}'
AND Filter = '{{ Filter }}'
AND DryRun = '{{ DryRun }}'
AND MaxResults = '{{ MaxResults }}'
;
INSERT examples
- create_image_usage_report
- Manifest
Creates a report that shows how your image is used across other Amazon Web Services accounts. The report provides visibility into which accounts are using the specified image, and how many resources (EC2 instances or launch templates) are referencing it. For more information, see View your AMI usage in the Amazon EC2 User Guide.
INSERT INTO aws.ec2.image_usage_reports (
ImageId,
ResourceType,
region,
DryRun,
AccountId,
ClientToken,
TagSpecification
)
SELECT
'{{ ImageId }}',
'{{ ResourceType }}',
'{{ region }}',
'{{ DryRun }}',
'{{ AccountId }}',
'{{ ClientToken }}',
'{{ TagSpecification }}'
RETURNING
report_id
;
# Description fields are for documentation purposes
- name: image_usage_reports
props:
- name: ImageId
value: "{{ ImageId }}"
description: Required parameter for the image_usage_reports resource.
- name: ResourceType
value: "{{ ResourceType }}"
description: Required parameter for the image_usage_reports resource.
- name: region
value: "{{ region }}"
description: Required parameter for the image_usage_reports resource.
- name: DryRun
value: {{ DryRun }}
description: 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.
description: 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.
- name: AccountId
value: "{{ AccountId }}"
description: The Amazon Web Services account IDs to include in the report. To include all accounts, omit this parameter.
description: The Amazon Web Services account IDs to include in the report. To include all accounts, omit this parameter.
- name: ClientToken
value: "{{ ClientToken }}"
description: A unique, case-sensitive identifier that you provide to ensure idempotency of the request.
description: A unique, case-sensitive identifier that you provide to ensure idempotency of the request.
- name: TagSpecification
value: "{{ TagSpecification }}"
description: The tags to apply to the report on creation. The ResourceType must be set to image-usage-report; any other value will cause the report creation to fail. To tag a report after it has been created, see CreateTags.
description: The tags to apply to the report on creation. The ResourceType must be set to image-usage-report; any other value will cause the report creation to fail. To tag a report after it has been created, see CreateTags.
DELETE examples
- delete_image_usage_report
Deletes the specified image usage report. For more information, see View your AMI usage in the Amazon EC2 User Guide.
DELETE FROM aws.ec2.image_usage_reports
WHERE ReportId = '{{ ReportId }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
;