interface LaunchTemplateSpotOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.LaunchTemplateSpotOptions |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#LaunchTemplateSpotOptions |
![]() | software.amazon.awscdk.services.ec2.LaunchTemplateSpotOptions |
![]() | aws_cdk.aws_ec2.LaunchTemplateSpotOptions |
![]() | aws-cdk-lib » aws_ec2 » LaunchTemplateSpotOptions |
Interface for the Spot market instance options provided in a LaunchTemplate.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
declare const expiration: cdk.Expiration;
const launchTemplateSpotOptions: ec2.LaunchTemplateSpotOptions = {
blockDuration: cdk.Duration.minutes(30),
interruptionBehavior: ec2.SpotInstanceInterruption.STOP,
maxPrice: 123,
requestType: ec2.SpotRequestType.ONE_TIME,
validUntil: expiration,
};
Properties
Name | Type | Description |
---|---|---|
block | Duration | Spot Instances with a defined duration (also known as Spot blocks) are designed not to be interrupted and will run continuously for the duration you select. |
interruption | Spot | The behavior when a Spot Instance is interrupted. |
max | number | Maximum hourly price you're willing to pay for each Spot instance. |
request | Spot | The Spot Instance request type. |
valid | Expiration | The end date of the request. |
blockDuration?
Type:
Duration
(optional, default: Requested spot instances do not have a pre-defined duration.)
Spot Instances with a defined duration (also known as Spot blocks) are designed not to be interrupted and will run continuously for the duration you select.
You can use a duration of 1, 2, 3, 4, 5, or 6 hours.
interruptionBehavior?
Type:
Spot
(optional, default: Spot instances will terminate when interrupted.)
The behavior when a Spot Instance is interrupted.
maxPrice?
Type:
number
(optional, default: Maximum hourly price will default to the on-demand price for the instance type.)
Maximum hourly price you're willing to pay for each Spot instance.
The value is given in dollars. ex: 0.01 for 1 cent per hour, or 0.001 for one-tenth of a cent per hour.
requestType?
Type:
Spot
(optional, default: One-time spot request.)
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:
Expiration
(optional, default: The default end date is 7 days from the current date.)
The end date of the request.
For a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.