Amazon Elastic Compute Cloud

2022/02/03 - Amazon Elastic Compute Cloud - 2 new api methods

Changes  adds support for AMIs in Recycle Bin

ListImagesInRecycleBin (new) Link ¶

Lists one or more AMIs that are currently in the Recycle Bin. For more information, see Recycle Bin in the Amazon Elastic Compute Cloud User Guide.

See also: AWS API Documentation

Request Syntax

client.list_images_in_recycle_bin(
    ImageIds=[
        'string',
    ],
    NextToken='string',
    MaxResults=123,
    DryRun=True|False
)
type ImageIds:

list

param ImageIds:

The IDs of the AMIs to list. Omit this parameter to list all of the AMIs that are in the Recycle Bin. You can specify up to 20 IDs in a single request.

  • (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 with a single call. To retrieve the remaining results, make another call with the returned nextToken value.

If you do not specify a value for MaxResults, the request returns 1,000 items per page by default. For more information, see Pagination.

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

{
    'Images': [
        {
            'ImageId': 'string',
            'Name': 'string',
            'Description': 'string',
            'RecycleBinEnterTime': datetime(2015, 1, 1),
            'RecycleBinExitTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Images (list) --

      Information about the AMIs.

      • (dict) --

        Information about an AMI that is currently in the Recycle Bin.

        • ImageId (string) --

          The ID of the AMI.

        • Name (string) --

          The name of the AMI.

        • Description (string) --

          The description of the AMI.

        • RecycleBinEnterTime (datetime) --

          The date and time when the AMI entered the Recycle Bin.

        • RecycleBinExitTime (datetime) --

          The date and time when the AMI is to be permanently deleted from the Recycle Bin.

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

RestoreImageFromRecycleBin (new) Link ¶

Restores an AMI from the Recycle Bin. For more information, see Recycle Bin in the Amazon Elastic Compute Cloud User Guide.

See also: AWS API Documentation

Request Syntax

client.restore_image_from_recycle_bin(
    ImageId='string',
    DryRun=True|False
)
type ImageId:

string

param ImageId:

[REQUIRED]

The ID of the AMI to restore.

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

{
    'Return': True|False
}

Response Structure

  • (dict) --

    • Return (boolean) --

      Returns true if the request succeeds; otherwise, it returns an error.