Configure Windows fast launch settings for your Amazon EC2 Windows Server AMI - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Configure Windows fast launch settings for your Amazon EC2 Windows Server AMI

You can configure Windows AMIs that you own for faster launching with the Amazon Web Services Management Console, API, SDKs, CloudFormation, or Amazon Command Line Interface (Amazon CLI). The following sections cover configuration steps for the Amazon EC2 console and Amazon CLI.

Enable Windows fast launch

To enable Windows fast launch, choose the tab that matches your environment, and follow the steps.

Note

Before changing these settings, make sure that your AMI, and the Region that you run in meet all Prerequisites.

Console
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, under Images, choose AMIs.

  3. Choose the AMI to update by selecting the check box next to the Name.

  4. From the Actions menu above the list of AMIs, choose Configure fast launch. This opens the Configure fast launch page, where you configure the settings for Windows fast launch.

  5. To start using pre-provisioned snapshots to launch instances from your Windows AMI faster, select the Enable fast launch for Windows check box.

  6. From the Set anticipated launch frequency drop-down list, choose a value to specify the number of snapshots that are created and maintained to cover your expected instance launch volume.

  7. When you're done making changes, choose Save changes.

Note

If you need to use a launch template to specify a non-default VPC, or to configure metadata settings for IMDSv2, see Use a launch template when you set up Windows fast launch.

Amazon CLI

The enable-fast-launch command calls the Amazon EC2 EnableFastLaunch API operation.

Syntax:

aws ec2 enable-fast-launch \ --image-id <value> \ --resource-type <value> \ (optional) --snapshot-configuration <value> \ (optional) --launch-template <value> \ (optional) --max-parallel-launches <value> \ (optional) --dry-run | --no-dry-run \ (optional) --cli-input-json <value> \ (optional) --generate-cli-skeleton <value> \ (optional)
Example:

The following enable-fast-launch example enables Windows fast launch for the specified AMI, launching six parallel instances for pre-provisioning. The ResourceType is set to snapshot, which is the default value.

aws ec2 enable-fast-launch \ --image-id ami-01234567890abcedf \ --max-parallel-launches 6 \ --resource-type snapshot

Output:

{ "ImageId": "ami-01234567890abcedf", "ResourceType": "snapshot", "SnapshotConfiguration": { "TargetResourceCount": 10 }, "LaunchTemplate": {}, "MaxParallelLaunches": 6, "OwnerId": "0123456789123", "State": "enabling", "StateTransitionReason": "Client.UserInitiated", "StateTransitionTime": "2022-01-27T22:16:03.199000+00:00" }
Tools for Windows PowerShell

The Enable-EC2FastLaunch cmdlet calls the Amazon EC2 EnableFastLaunch API operation to enable Windows fast launch on your Windows AMI.

Syntax:

Enable-EC2FastLaunch -ImageId <String> -LaunchTemplate_LaunchTemplateId <String> -LaunchTemplate_LaunchTemplateName <String> -MaxParallelLaunch <Int32> -ResourceType <String> -SnapshotConfiguration_TargetResourceCount <Int32> -LaunchTemplate_Version <String> -Select <String> -PassThru <SwitchParameter> -Force <SwitchParameter>
Example:

The following Enable-EC2FastLaunch example enables Windows fast launch for the specified AMI, launching six parallel instances for pre-provisioning. The ResourceType is set to snapshot, which is the default value.

Enable-EC2FastLaunch ` -ImageId ami-01234567890abcedf ` -MaxParallelLaunch 6 ` -Region us-west-2 ` -ResourceType snapshot

Output:

ImageId : ami-01234567890abcedf LaunchTemplate : MaxParallelLaunches : 6 OwnerId : 0123456789123 ResourceType : snapshot SnapshotConfiguration : Amazon.EC2.Model.FastLaunchSnapshotConfigurationResponse State : enabling StateTransitionReason : Client.UserInitiated StateTransitionTime : 2/25/2022 12:24:11 PM

Disable Windows fast launch

To disable Windows fast launch, choose the tab that matches your environment, and follow the steps.

Note

Before changing these settings, make sure that your AMI, and the Region that you run in meet all Prerequisites.

Console
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, under Images, choose AMIs.

  3. Choose the AMI to update by selecting the check box next to the Name.

  4. From the Actions menu above the list of AMIs, choose Configure fast launch. This opens the Configure fast launch page, where you configure the settings for Windows fast launch.

  5. Clear the Enable fast launch for Windows check box to disable Windows fast launch and to remove pre-provisioned snapshots. This results in the AMI using the standard launch process for each instance, going forward.

    Note

    When you disable Windows image optimization, any existing pre-provisioned snapshots are automatically deleted. This step must be completed before you can start using the feature again.

  6. When you're done making changes, choose Save changes.

Amazon CLI

The disable-fast-launch command calls the Amazon EC2 DisableFastLaunch API operation.

Syntax:

aws ec2 disable-fast-launch \ --image-id <value> \ --force | --no-force \ (optional) --dry-run | --no-dry-run \ (optional) --cli-input-json <value> \ (optional) --generate-cli-skeleton <value> \ (optional)
Example:

The following disable-fast-launch example disables Windows fast launch on the specified AMI, and cleans up existing pre-provisioned snapshots.

aws ec2 disable-fast-launch \ --image-id ami-01234567890abcedf

Output:

{ "ImageId": "ami-01234567890abcedf", "ResourceType": "snapshot", "SnapshotConfiguration": {}, "LaunchTemplate": { "LaunchTemplateId": "lt-01234567890abcedf", "LaunchTemplateName": "EC2FastLaunchDefaultResourceCreation-a8c6215d-94e6-441b-9272-dbd1f87b07e2", "Version": "1" }, "MaxParallelLaunches": 6, "OwnerId": "0123456789123", "State": "disabling", "StateTransitionReason": "Client.UserInitiated", "StateTransitionTime": "2022-01-27T22:47:29.265000+00:00" }
Tools for Windows PowerShell

The Disable-EC2FastLaunch cmdlet calls the Amazon EC2 DisableFastLaunch API operation.

Syntax:

Disable-EC2FastLaunch -ImageId <String> -ForceStop <Boolean> -Select <String> -PassThru <SwitchParameter> -Force <SwitchParameter>
Example:

The following Disable-EC2FastLaunch example disables Windows fast launch on the specified AMI, and cleans up existing pre-provisioned snapshots.

Disable-EC2FastLaunch -ImageId ami-01234567890abcedf

Output:

ImageId : ami-01234567890abcedf LaunchTemplate : Amazon.EC2.Model.FastLaunchLaunchTemplateSpecificationResponse MaxParallelLaunches : 6 OwnerId : 0123456789123 ResourceType : snapshot SnapshotConfiguration : State : disabling StateTransitionReason : Client.UserInitiated StateTransitionTime : 2/25/2022 1:10:08 PM

Use a launch template when you set up Windows fast launch

With a launch template, you can configure a set of launch parameters that Amazon EC2 uses each time it launches an instance from that template. You can specify such things as an AMI to use for your base image, instance types, storage, network settings, and more.

Launch templates are optional, except for the following specific cases, where you must use a launch template for your Windows AMI when you configure faster launching:

  • You must use a launch template to specify a non-default VPC for your Windows AMI.

  • If your account includes a policy that enforces IMDSv2 for Amazon EC2 instances, you must create a launch template that specifies the metadata configuration to enforce IMDSv2.

    Use the launch template that includes your metadata configuration from the EC2 console, or when you run the enable-fast-launch command in the Amazon CLI, or call the EnableFastLaunch API action.

Note

Amazon EC2 Windows fast launch doesn't support user data scripts in the launch template. If you use a launch template for Windows fast launch, you must not specify user data.

Specify a non-default VPC

Step 1: Create a launch template

Create a launch template that specifies the following details for your Windows instances:

  • The VPC subnet.

  • An instance type of t3.xlarge.

For more information, see Create a launch template.

Step 2: Specify the launch template for your Windows fast launch AMI

Choose the tab that matches your process:

Console

To specify the launch template for Windows fast launch from the Amazon Web Services Management Console, follow these steps:

  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, under Images, choose AMIs.

  3. Choose the AMI to update by selecting the check box next to the Name.

  4. From the Actions menu above the list of AMIs, choose Configure fast launch. This opens the Configure fast launch page, where you configure the settings for Windows fast launch.

  5. The Launch template box performs a filtered search that finds launch templates in your account in the current Region that match the text you've entered. Specify all or part of the launch template name or ID in the box to show a list of matching launch templates. For example, if you enter fast in the box, Amazon EC2 finds all of the launch templates in your account in the current Region that have "fast" in the name.

    To create a new launch template, you can choose Create launch template.

  6. When you select a launch template, Amazon EC2 shows the default version for that template in the Source template version box. To specify a different version, highlight the default version to replace it, and enter the version number you want in the box.

  7. When you're done making changes, choose Save changes.

Amazon CLI, API

To specify the launch template for Windows fast launch from the Amazon CLI, specify the launch template name or ID in the --launch-template parameter when you run the enable-fast-launch command in the Amazon CLI.

To specify the launch template for Windows fast launch in an API request, specify the launch template name or ID in the LaunchTemplate parameter when you call the EnableFastLaunch API action.

For more information about EC2 launch templates, see Launch an instance from a launch template.

Create a custom image with Windows fast launch enabled

Amazon EC2 Windows fast launch integrates with EC2 Image Builder to help you create custom images with Windows fast launch enabled. For more information, see Create distribution settings for a Windows AMI with EC2 Fast Launch enabled (Amazon CLI) in the EC2 Image Builder User Guide.