aws-cdk-lib.aws_ec2.CfnLaunchTemplate.SpotOptionsProperty

interface SpotOptionsProperty

LanguageType name
.NETAmazon.CDK.AWS.EC2.CfnLaunchTemplate.SpotOptionsProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnLaunchTemplate_SpotOptionsProperty
Javasoftware.amazon.awscdk.services.ec2.CfnLaunchTemplate.SpotOptionsProperty
Pythonaws_cdk.aws_ec2.CfnLaunchTemplate.SpotOptionsProperty
TypeScript aws-cdk-lib » aws_ec2 » CfnLaunchTemplate » SpotOptionsProperty

Specifies options for Spot Instances.

SpotOptions is a property of AWS::EC2::LaunchTemplate InstanceMarketOptions .

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const spotOptionsProperty: ec2.CfnLaunchTemplate.SpotOptionsProperty = {
  blockDurationMinutes: 123,
  instanceInterruptionBehavior: 'instanceInterruptionBehavior',
  maxPrice: 'maxPrice',
  spotInstanceType: 'spotInstanceType',
  validUntil: 'validUntil',
};

Properties

NameTypeDescription
blockDurationMinutes?numberDeprecated.
instanceInterruptionBehavior?stringThe behavior when a Spot Instance is interrupted.
maxPrice?stringThe maximum hourly price you're willing to pay for the Spot Instances.
spotInstanceType?stringThe Spot Instance request type.
validUntil?stringThe end date of the request, in UTC format ( YYYY-MM-DD T HH:MM:SS Z). Supported only for persistent requests.

blockDurationMinutes?

Type: number (optional)

Deprecated.


instanceInterruptionBehavior?

Type: string (optional)

The behavior when a Spot Instance is interrupted.

The default is terminate .


maxPrice?

Type: string (optional)

The maximum hourly price you're willing to pay for the Spot Instances.

We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.

If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not specify this parameter.


spotInstanceType?

Type: string (optional)

The Spot Instance request type.

If you are using Spot Instances with an Auto Scaling group, use one-time requests, as the Amazon EC2 Auto Scaling service handles requesting new Spot Instances whenever the group is below its desired capacity.


validUntil?

Type: string (optional)

The end date of the request, in UTC format ( YYYY-MM-DD T HH:MM:SS Z). Supported only for persistent requests.

  • For a persistent request, the request remains active until the ValidUntil date and time is reached. Otherwise, the request remains active until you cancel it.
  • For a one-time request, ValidUntil is not supported. The request remains active until all instances launch or you cancel the request.

Default: 7 days from the current date