Skip to main content

store_image_tasks

Creates, updates, deletes, gets or lists a store_image_tasks resource.

Overview

Namestore_image_tasks
TypeResource
Idaws.ec2.store_image_tasks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
ami_idstringThe ID of the AMI that is being stored.
bucketstringThe name of the Amazon S3 bucket that contains the stored AMI object.
progress_percentageintegerThe progress of the task as a percentage.
s3object_keystringThe name of the stored AMI object in the bucket.
store_task_failure_reasonstringIf the tasks fails, the reason for the failure is returned. If the task succeeds, null is returned.
store_task_statestringThe state of the store task (InProgress, Completed, or Failed).
task_start_timestringThe time the task started.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_store_image_tasksselectregionImageId, DryRun, Filter, NextToken, MaxResultsDescribes the progress of the AMI store tasks. You can describe the store tasks for specified AMIs. If you don't specify the AMIs, you get a paginated list of store tasks from the last 31 days. For each AMI task, the response indicates if the task is InProgress, Completed, or Failed. For tasks InProgress, the response shows the estimated progress as a percentage. Tasks are listed in reverse chronological order. Currently, only tasks from the past 31 days can be viewed. To use this API, you must have the required permissions. For more information, see Permissions for storing and restoring AMIs using S3 in the Amazon EC2 User Guide. For more information, see Store and restore an AMI using S3 in the Amazon EC2 User Guide.
create_store_image_taskinsertImageId, regionBucket, S3ObjectTag, DryRunStores an AMI as a single object in an Amazon S3 bucket. To use this API, you must have the required permissions. For more information, see Permissions for storing and restoring AMIs using S3 in the Amazon EC2 User Guide. For more information, see Store and restore an AMI using S3 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
ImageIdstringThe ID of the AMI.
regionstringAWS region (default: us-east-1)
BucketstringThe name of the Amazon S3 bucket in which the AMI object will be stored. The bucket must be in the Region in which the request is being made. The AMI object appears in the bucket only after the upload task has completed.
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.
FilterarrayThe filters. task-state - Returns tasks in a certain state (InProgress | Completed | Failed) bucket - Returns task information for tasks that targeted a specific bucket. For the filter value, specify the bucket name. When you specify the ImageIds parameter, any filters that you specify are ignored. To use the filters, you must remove the ImageIds parameter.
ImageIdarrayThe AMI IDs for which to show progress. Up to 20 AMI IDs can be included in a request.
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. You cannot specify this parameter and the ImageIds parameter in the same call.
NextTokenstringThe token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
S3ObjectTagarrayThe tags to apply to the AMI object that will be stored in the Amazon S3 bucket.

SELECT examples

Describes the progress of the AMI store tasks. You can describe the store tasks for specified AMIs. If you don't specify the AMIs, you get a paginated list of store tasks from the last 31 days. For each AMI task, the response indicates if the task is InProgress, Completed, or Failed. For tasks InProgress, the response shows the estimated progress as a percentage. Tasks are listed in reverse chronological order. Currently, only tasks from the past 31 days can be viewed. To use this API, you must have the required permissions. For more information, see Permissions for storing and restoring AMIs using S3 in the Amazon EC2 User Guide. For more information, see Store and restore an AMI using S3 in the Amazon EC2 User Guide.

SELECT
ami_id,
bucket,
progress_percentage,
s3object_key,
store_task_failure_reason,
store_task_state,
task_start_time
FROM aws.ec2.store_image_tasks
WHERE region = '{{ region }}' -- required
AND ImageId = '{{ ImageId }}'
AND DryRun = '{{ DryRun }}'
AND Filter = '{{ Filter }}'
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
;

INSERT examples

Stores an AMI as a single object in an Amazon S3 bucket. To use this API, you must have the required permissions. For more information, see Permissions for storing and restoring AMIs using S3 in the Amazon EC2 User Guide. For more information, see Store and restore an AMI using S3 in the Amazon EC2 User Guide.

INSERT INTO aws.ec2.store_image_tasks (
ImageId,
region,
Bucket,
S3ObjectTag,
DryRun
)
SELECT
'{{ ImageId }}',
'{{ region }}',
'{{ Bucket }}',
'{{ S3ObjectTag }}',
'{{ DryRun }}'
RETURNING
object_key
;