Amazon Elastic Compute Cloud

2021/04/06 - Amazon Elastic Compute Cloud - 3 new api methods

Changes  This release adds support for storing EBS-backed AMIs in S3 and restoring them from S3 to enable cross-partition copying of AMIs

DescribeStoreImageTasks (new) Link ¶

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 Elastic Compute Cloud User Guide .

For more information, see Store and restore an AMI using S3 in the Amazon Elastic Compute Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.describe_store_image_tasks(
    ImageIds=[
        'string',
    ],
    DryRun=True|False,
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    NextToken='string',
    MaxResults=123
)
type ImageIds

list

param ImageIds

The AMI IDs for which to show progress. Up to 20 AMI IDs can be included in a request.

  • (string) --

type DryRun

boolean

param DryRun

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 .

type Filters

list

param Filters

The 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.

  • (dict) --

    A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs.

    • Name (string) --

      The name of the filter. Filter names are case-sensitive.

    • Values (list) --

      The filter values. Filter values are case-sensitive.

      • (string) --

type NextToken

string

param NextToken

The token for the next page of results.

type MaxResults

integer

param MaxResults

The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value. This value can be between 1 and 200. You cannot specify this parameter and the ImageIDs parameter in the same call.

rtype

dict

returns

Response Syntax

{
    'StoreImageTaskResults': [
        {
            'AmiId': 'string',
            'TaskStartTime': datetime(2015, 1, 1),
            'Bucket': 'string',
            'S3objectKey': 'string',
            'ProgressPercentage': 123,
            'StoreTaskState': 'string',
            'StoreTaskFailureReason': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • StoreImageTaskResults (list) --

      The information about the AMI store tasks.

      • (dict) --

        The information about the AMI store task, including the progress of the task.

        • AmiId (string) --

          The ID of the AMI that is being stored.

        • TaskStartTime (datetime) --

          The time the task started.

        • Bucket (string) --

          The name of the S3 bucket that contains the stored AMI object.

        • S3objectKey (string) --

          The name of the stored AMI object in the bucket.

        • ProgressPercentage (integer) --

          The progress of the task as a percentage.

        • StoreTaskState (string) --

          The state of the store task ( InProgress , Completed , or Failed ).

        • StoreTaskFailureReason (string) --

          If the tasks fails, the reason for the failure is returned. If the task succeeds, null is returned.

    • NextToken (string) --

      The token to use to retrieve the next page of results. This value is null when there are no more results to return.

CreateRestoreImageTask (new) Link ¶

Starts a task that restores an AMI from an S3 object that was previously created by using CreateStoreImageTask.

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 Elastic Compute Cloud User Guide .

For more information, see Store and restore an AMI using S3 in the Amazon Elastic Compute Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.create_restore_image_task(
    Bucket='string',
    ObjectKey='string',
    Name='string',
    TagSpecifications=[
        {
            'ResourceType': 'client-vpn-endpoint'|'customer-gateway'|'dedicated-host'|'dhcp-options'|'egress-only-internet-gateway'|'elastic-ip'|'elastic-gpu'|'export-image-task'|'export-instance-task'|'fleet'|'fpga-image'|'host-reservation'|'image'|'import-image-task'|'import-snapshot-task'|'instance'|'internet-gateway'|'key-pair'|'launch-template'|'local-gateway-route-table-vpc-association'|'natgateway'|'network-acl'|'network-interface'|'network-insights-analysis'|'network-insights-path'|'placement-group'|'reserved-instances'|'route-table'|'security-group'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-connect-peer'|'transit-gateway-multicast-domain'|'transit-gateway-route-table'|'volume'|'vpc'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    DryRun=True|False
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the S3 bucket that contains the stored AMI object.

type ObjectKey

string

param ObjectKey

[REQUIRED]

The name of the stored AMI object in the bucket.

type Name

string

param Name

The name for the restored AMI. The name must be unique for AMIs in the Region for this account. If you do not provide a name, the new AMI gets the same name as the original AMI.

type TagSpecifications

list

param TagSpecifications

The tags to apply to the AMI and snapshots on restoration. You can tag the AMI, the snapshots, or both.

  • To tag the AMI, the value for ResourceType must be image .

  • To tag the snapshots, the value for ResourceType must be snapshot . The same tag is applied to all of the snapshots that are created.

  • (dict) --

    The tags to apply to a resource when the resource is being created.

    • ResourceType (string) --

      The type of resource to tag. Currently, the resource types that support tagging on creation are: capacity-reservation | carrier-gateway | client-vpn-endpoint | customer-gateway | dedicated-host | dhcp-options | egress-only-internet-gateway | elastic-ip | elastic-gpu | export-image-task | export-instance-task | fleet | fpga-image | host-reservation | image | import-image-task | import-snapshot-task | instance | internet-gateway | ipv4pool-ec2 | ipv6pool-ec2 | key-pair | launch-template | local-gateway-route-table-vpc-association | placement-group | prefix-list | natgateway | network-acl | network-interface | reserved-instances | route-table | security-group | snapshot | spot-fleet-request | spot-instances-request | snapshot | subnet | traffic-mirror-filter | traffic-mirror-session | traffic-mirror-target | transit-gateway | transit-gateway-attachment | transit-gateway-multicast-domain | transit-gateway-route-table | volume | vpc | vpc-peering-connection | vpc-endpoint (for interface and gateway endpoints) | vpc-endpoint-service (for AWS PrivateLink) | vpc-flow-log | vpn-connection | vpn-gateway .

      To tag a resource after it has been created, see CreateTags.

    • Tags (list) --

      The tags to apply to the resource.

      • (dict) --

        Describes a tag.

        • Key (string) --

          The key of the tag.

          Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws: .

        • Value (string) --

          The value of the tag.

          Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.

type DryRun

boolean

param DryRun

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 .

rtype

dict

returns

Response Syntax

{
    'ImageId': 'string'
}

Response Structure

  • (dict) --

    • ImageId (string) --

      The AMI ID.

CreateStoreImageTask (new) Link ¶

Stores an AMI as a single object in an 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 Elastic Compute Cloud User Guide .

For more information, see Store and restore an AMI using S3 in the Amazon Elastic Compute Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.create_store_image_task(
    ImageId='string',
    Bucket='string',
    S3ObjectTags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    DryRun=True|False
)
type ImageId

string

param ImageId

[REQUIRED]

The ID of the AMI.

type Bucket

string

param Bucket

[REQUIRED]

The name of the 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.

type S3ObjectTags

list

param S3ObjectTags

The tags to apply to the AMI object that will be stored in the S3 bucket.

  • (dict) --

    The tags to apply to the AMI object that will be stored in the S3 bucket. For more information, see Categorizing your storage using tags in the Amazon Simple Storage Service User Guide .

    • Key (string) --

      The key of the tag.

      Constraints: Tag keys are case-sensitive and can be up to 128 Unicode characters in length. May not begin with aws :.

    • Value (string) --

      The value of the tag.

      Constraints: Tag values are case-sensitive and can be up to 256 Unicode characters in length.

type DryRun

boolean

param DryRun

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 .

rtype

dict

returns

Response Syntax

{
    'ObjectKey': 'string'
}

Response Structure

  • (dict) --

    • ObjectKey (string) --

      The name of the stored AMI object in the S3 bucket.