Amazon Elastic Compute Cloud

2022/01/10 - Amazon Elastic Compute Cloud - 3 new api methods

Changes  New feature: Updated EC2 API to support faster launching for Windows images. Optimized images are pre-provisioned, using snapshots to launch instances up to 65% faster.

EnableFastLaunch (new) Link ¶

When you enable faster launching for a Windows AMI, images are pre-provisioned, using snapshots to launch instances up to 65% faster. To create the optimized Windows image, Amazon EC2 launches an instance and runs through Sysprep steps, rebooting as required. Then it creates a set of reserved snapshots that are used for subsequent launches. The reserved snapshots are automatically replenished as they are used, depending on your settings for launch frequency.

See also: AWS API Documentation

Request Syntax

client.enable_fast_launch(
    ImageId='string',
    ResourceType='string',
    SnapshotConfiguration={
        'TargetResourceCount': 123
    },
    LaunchTemplate={
        'LaunchTemplateId': 'string',
        'LaunchTemplateName': 'string',
        'Version': 'string'
    },
    MaxParallelLaunches=123,
    DryRun=True|False
)
type ImageId:

string

param ImageId:

[REQUIRED]

The ID of the image for which you’re enabling faster launching.

type ResourceType:

string

param ResourceType:

The type of resource to use for pre-provisioning the Windows AMI for faster launching. Supported values include: snapshot, which is the default value.

type SnapshotConfiguration:

dict

param SnapshotConfiguration:

Configuration settings for creating and managing the snapshots that are used for pre-provisioning the Windows AMI for faster launching. The associated ResourceType must be snapshot.

  • TargetResourceCount (integer) --

    The number of pre-provisioned snapshots to keep on hand for a fast-launch enabled Windows AMI.

type LaunchTemplate:

dict

param LaunchTemplate:

The launch template to use when launching Windows instances from pre-provisioned snapshots. Launch template parameters can include either the name or ID of the launch template, but not both.

  • LaunchTemplateId (string) --

    The ID of the launch template to use for faster launching for a Windows AMI.

  • LaunchTemplateName (string) --

    The name of the launch template to use for faster launching for a Windows AMI.

  • Version (string) -- [REQUIRED]

    The version of the launch template to use for faster launching for a Windows AMI.

type MaxParallelLaunches:

integer

param MaxParallelLaunches:

The maximum number of parallel instances to launch for creating resources.

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',
    'ResourceType': 'snapshot',
    'SnapshotConfiguration': {
        'TargetResourceCount': 123
    },
    'LaunchTemplate': {
        'LaunchTemplateId': 'string',
        'LaunchTemplateName': 'string',
        'Version': 'string'
    },
    'MaxParallelLaunches': 123,
    'OwnerId': 'string',
    'State': 'enabling'|'enabling-failed'|'enabled'|'enabled-failed'|'disabling'|'disabling-failed',
    'StateTransitionReason': 'string',
    'StateTransitionTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ImageId (string) --

      The image ID that identifies the Windows AMI for which faster launching was enabled.

    • ResourceType (string) --

      The type of resource that was defined for pre-provisioning the Windows AMI for faster launching.

    • SnapshotConfiguration (dict) --

      The configuration settings that were defined for creating and managing the pre-provisioned snapshots for faster launching of the Windows AMI. This property is returned when the associated resourceType is snapshot.

      • TargetResourceCount (integer) --

        The number of pre-provisioned snapshots requested to keep on hand for a fast-launch enabled Windows AMI.

    • LaunchTemplate (dict) --

      The launch template that is used when launching Windows instances from pre-provisioned snapshots.

      • LaunchTemplateId (string) --

        The ID of the launch template for faster launching of the associated Windows AMI.

      • LaunchTemplateName (string) --

        The name of the launch template for faster launching of the associated Windows AMI.

      • Version (string) --

        The version of the launch template for faster launching of the associated Windows AMI.

    • MaxParallelLaunches (integer) --

      The maximum number of parallel instances to launch for creating resources.

    • OwnerId (string) --

      The owner ID for the Windows AMI for which faster launching was enabled.

    • State (string) --

      The current state of faster launching for the specified Windows AMI.

    • StateTransitionReason (string) --

      The reason that the state changed for faster launching for the Windows AMI.

    • StateTransitionTime (datetime) --

      The time that the state changed for faster launching for the Windows AMI.

DisableFastLaunch (new) Link ¶

Discontinue faster launching for a Windows AMI, and clean up existing pre-provisioned snapshots. When you disable faster launching, the AMI uses the standard launch process for each instance. All pre-provisioned snapshots must be removed before you can enable faster launching again.

See also: AWS API Documentation

Request Syntax

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

string

param ImageId:

[REQUIRED]

The ID of the image for which you’re turning off faster launching, and removing pre-provisioned snapshots.

type Force:

boolean

param Force:

Forces the image settings to turn off faster launching for your Windows AMI. This parameter overrides any errors that are encountered while cleaning up resources in your account.

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',
    'ResourceType': 'snapshot',
    'SnapshotConfiguration': {
        'TargetResourceCount': 123
    },
    'LaunchTemplate': {
        'LaunchTemplateId': 'string',
        'LaunchTemplateName': 'string',
        'Version': 'string'
    },
    'MaxParallelLaunches': 123,
    'OwnerId': 'string',
    'State': 'enabling'|'enabling-failed'|'enabled'|'enabled-failed'|'disabling'|'disabling-failed',
    'StateTransitionReason': 'string',
    'StateTransitionTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ImageId (string) --

      The ID of the image for which faster-launching has been turned off.

    • ResourceType (string) --

      The pre-provisioning resource type that must be cleaned after turning off faster launching for the Windows AMI. Supported values include: snapshot.

    • SnapshotConfiguration (dict) --

      Parameters that were used for faster launching for the Windows AMI before faster launching was turned off. This informs the clean-up process.

      • TargetResourceCount (integer) --

        The number of pre-provisioned snapshots requested to keep on hand for a fast-launch enabled Windows AMI.

    • LaunchTemplate (dict) --

      The launch template that was used to launch Windows instances from pre-provisioned snapshots.

      • LaunchTemplateId (string) --

        The ID of the launch template for faster launching of the associated Windows AMI.

      • LaunchTemplateName (string) --

        The name of the launch template for faster launching of the associated Windows AMI.

      • Version (string) --

        The version of the launch template for faster launching of the associated Windows AMI.

    • MaxParallelLaunches (integer) --

      The maximum number of parallel instances to launch for creating resources.

    • OwnerId (string) --

      The owner of the Windows AMI for which faster launching was turned off.

    • State (string) --

      The current state of faster launching for the specified Windows AMI.

    • StateTransitionReason (string) --

      The reason that the state changed for faster launching for the Windows AMI.

    • StateTransitionTime (datetime) --

      The time that the state changed for faster launching for the Windows AMI.

DescribeFastLaunchImages (new) Link ¶

Describe details for Windows AMIs that are configured for faster launching.

See also: AWS API Documentation

Request Syntax

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

list

param ImageIds:

Details for one or more Windows AMI image IDs.

  • (string) --

type Filters:

list

param Filters:

Use the following filters to streamline results.

  • resource-type - The resource type for pre-provisioning.

  • launch-template - The launch template that is associated with the pre-provisioned Windows AMI.

  • owner-id - The owner ID for the pre-provisioning resource.

  • state - The current state of fast launching for the Windows AMI.

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

    If you specify multiple filters, the filters are joined with an AND, and the request returns only results that match all of the specified filters.

    • Name (string) --

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

    • Values (list) --

      The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values.

      • (string) --

type MaxResults:

integer

param MaxResults:

The maximum number of results to return in a single call. To retrieve the remaining results, make another request with the returned NextToken value. If this parameter is not specified, then all results are returned.

type NextToken:

string

param NextToken:

The token for the next set of results.

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

{
    'FastLaunchImages': [
        {
            'ImageId': 'string',
            'ResourceType': 'snapshot',
            'SnapshotConfiguration': {
                'TargetResourceCount': 123
            },
            'LaunchTemplate': {
                'LaunchTemplateId': 'string',
                'LaunchTemplateName': 'string',
                'Version': 'string'
            },
            'MaxParallelLaunches': 123,
            'OwnerId': 'string',
            'State': 'enabling'|'enabling-failed'|'enabled'|'enabled-failed'|'disabling'|'disabling-failed',
            'StateTransitionReason': 'string',
            'StateTransitionTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • FastLaunchImages (list) --

      A collection of details about the fast-launch enabled Windows images that meet the requested criteria.

      • (dict) --

        Describe details about a fast-launch enabled Windows image that meets the requested criteria. Criteria are defined by the DescribeFastLaunchImages action filters.

        • ImageId (string) --

          The image ID that identifies the fast-launch enabled Windows image.

        • ResourceType (string) --

          The resource type that is used for pre-provisioning the Windows AMI. Supported values include: snapshot.

        • SnapshotConfiguration (dict) --

          A group of parameters that are used for pre-provisioning the associated Windows AMI using snapshots.

          • TargetResourceCount (integer) --

            The number of pre-provisioned snapshots requested to keep on hand for a fast-launch enabled Windows AMI.

        • LaunchTemplate (dict) --

          The launch template that the fast-launch enabled Windows AMI uses when it launches Windows instances from pre-provisioned snapshots.

          • LaunchTemplateId (string) --

            The ID of the launch template for faster launching of the associated Windows AMI.

          • LaunchTemplateName (string) --

            The name of the launch template for faster launching of the associated Windows AMI.

          • Version (string) --

            The version of the launch template for faster launching of the associated Windows AMI.

        • MaxParallelLaunches (integer) --

          The maximum number of parallel instances that are launched for creating resources.

        • OwnerId (string) --

          The owner ID for the fast-launch enabled Windows AMI.

        • State (string) --

          The current state of faster launching for the specified Windows AMI.

        • StateTransitionReason (string) --

          The reason that faster launching for the Windows AMI changed to the current state.

        • StateTransitionTime (datetime) --

          The time that faster launching for the Windows AMI changed to the current state.

    • NextToken (string) --

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