You can configure EC2 Fast Launch for Windows AMIs that you own, or AMIs
that are shared with you from the AWS Management Console, API, SDKs, CloudFormation, or AWS Command Line Interface (AWS CLI).
Before you configure EC2 Fast Launch, verify that your AMI meets all of the prerequisites
that are required to create the pre-provisioned snapshots. For more information, see
EC2 Fast Launch prerequisites for Windows.
When you enable faster launching for Windows instances, Amazon EC2 checks to make sure that
you have the required permissions to launch instances from the specified AMI and Launch Template
(if provided), including permissions for encrypted AMIs. To prevent errors during the
instance launch process, the service validates your permissions before EC2 Fast Launch
is enabled. If you don't have the required permissions, the service returns an error, and
does not enable EC2 Fast Launch.
EC2 Fast Launch integrates with EC2 Image Builder to help you create custom
images with EC2 Fast Launch enabled. For more information, see Create distribution settings for a Windows AMI with EC2 Fast Launch enabled (AWS CLI)
in the EC2 Image Builder User Guide.
The following sections cover configuration steps for the Amazon EC2 console and AWS CLI.
Enable EC2 Fast Launch
To enable EC2 Fast Launch, choose the tab that matches your environment, and
follow the steps.
- Console
-
Open the Amazon EC2 console at
https://console.aws.amazon.com/ec2/.
-
In the navigation pane, under Images, choose
AMIs.
-
Choose the AMI to update by selecting the check box next to the
Name.
-
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 EC2 Fast Launch.
-
To start using pre-provisioned snapshots to launch instances from
your Windows AMI faster, select the Enable fast launch for Windows
checkbox.
-
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.
-
When you're done making changes, choose Save
changes.
- AWS 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 EC2 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"
}
- PowerShell
-
The Enable-EC2FastLaunch cmdlet calls the Amazon EC2 EnableFastLaunch
API operation to enable EC2 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 EC2 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 EC2 Fast Launch
To disable EC2 Fast Launch, choose the tab that matches your environment, and
follow the steps.
- Console
-
Open the Amazon EC2 console at
https://console.aws.amazon.com/ec2/.
-
In the navigation pane, under Images, choose
AMIs.
-
Choose the AMI to update by selecting the check box next to the
Name.
-
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 EC2 Fast Launch.
-
Clear the Enable fast launch for Windows
checkbox to disable EC2 Fast Launch and to remove
pre-provisioned snapshots. This results in the AMI using the
standard launch process for each instance, going forward.
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.
-
When you're done making changes, choose Save
changes.
- AWS 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 EC2 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"
}
- 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 EC2 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 EC2 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 AWS CLI, or call the EnableFastLaunch
API action.
Amazon EC2 EC2 Fast Launch doesn't support the following configuration when you use a launch
template. If you use a launch template for EC2 Fast Launch, you must not specify any of
the following:
-
User data scripts
-
Termination protection
-
Disabled metadata
-
Spot option
-
Shutdown behavior that terminates the instance
-
Resource tags for network interface, elastic graphic, or spot instance requests
Specify a non-default VPC
Step 1: Create a launch template
Create a launch template that specifies the following details for your
Windows instances:
For more information, see Create an Amazon EC2 launch template.
Step 2: Specify the launch template for your EC2 Fast Launch AMI
Choose the tab that matches your process:
- Console
-
To specify the launch template for EC2 Fast Launch from the AWS Management Console,
follow these steps:
Open the Amazon EC2 console at
https://console.aws.amazon.com/ec2/.
-
In the navigation pane, under Images, choose
AMIs.
-
Choose the AMI to update by selecting the check box next to the
Name.
-
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 EC2 Fast Launch.
-
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.
-
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.
-
When you're done making changes, choose Save
changes.
- AWS CLI, API
-
To specify the launch template for EC2 Fast Launch from the AWS CLI,
specify the launch template name or ID in the --launch-template
parameter
when you run the enable-fast-launch
command in the AWS CLI.
To specify the launch template for EC2 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
Store instance launch parameters in Amazon EC2 launch templates.