SpotInstanceRequest

Provides an EC2 Spot Instance Request resource. This allows instances to be requested on the spot market.

By default this provider creates Spot Instance Requests with a persistent type, which means that for the duration of their lifetime, AWS will launch an instance with the configured details if and when the spot market will accept the requested price.

On destruction, this provider will make an attempt to terminate the associated Spot Instance if there is one present.

Spot Instances requests with a one-time type will close the spot request when the instance is terminated either by the request being below the current spot price availability or by a user.

NOTE: Because their behavior depends on the live status of the spot market, Spot Instance Requests have a unique lifecycle that makes them behave differently than other resources. Most importantly: there is no guarantee that a Spot Instance exists to fulfill the request at any given point in time. See the AWS Spot Instance documentation for more information.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        // Request a spot instance at $0.03
        var cheapWorker = new Aws.Ec2.SpotInstanceRequest("cheapWorker", new Aws.Ec2.SpotInstanceRequestArgs
        {
            Ami = "ami-1234",
            InstanceType = "c4.xlarge",
            SpotPrice = "0.03",
            Tags = 
            {
                { "Name", "CheapWorker" },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := ec2.NewSpotInstanceRequest(ctx, "cheapWorker", &ec2.SpotInstanceRequestArgs{
            Ami:          pulumi.String("ami-1234"),
            InstanceType: pulumi.String("c4.xlarge"),
            SpotPrice:    pulumi.String("0.03"),
            Tags: pulumi.StringMap{
                "Name": pulumi.String("CheapWorker"),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

# Request a spot instance at $0.03
cheap_worker = aws.ec2.SpotInstanceRequest("cheapWorker",
    ami="ami-1234",
    instance_type="c4.xlarge",
    spot_price="0.03",
    tags={
        "Name": "CheapWorker",
    })
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Request a spot instance at $0.03
const cheapWorker = new aws.ec2.SpotInstanceRequest("cheap_worker", {
    ami: "ami-1234",
    instanceType: "c4.xlarge",
    spotPrice: "0.03",
    tags: {
        Name: "CheapWorker",
    },
});

Create a SpotInstanceRequest Resource

def SpotInstanceRequest(resource_name, opts=None, ami=None, associate_public_ip_address=None, availability_zone=None, block_duration_minutes=None, cpu_core_count=None, cpu_threads_per_core=None, credit_specification=None, disable_api_termination=None, ebs_block_devices=None, ebs_optimized=None, ephemeral_block_devices=None, get_password_data=None, hibernation=None, host_id=None, iam_instance_profile=None, instance_initiated_shutdown_behavior=None, instance_interruption_behaviour=None, instance_type=None, ipv6_address_count=None, ipv6_addresses=None, key_name=None, launch_group=None, metadata_options=None, monitoring=None, network_interfaces=None, placement_group=None, private_ip=None, root_block_device=None, security_groups=None, source_dest_check=None, spot_price=None, spot_type=None, subnet_id=None, tags=None, tenancy=None, user_data=None, user_data_base64=None, valid_from=None, valid_until=None, volume_tags=None, vpc_security_group_ids=None, wait_for_fulfillment=None, __props__=None);
name string
The unique name of the resource.
args SpotInstanceRequestArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SpotInstanceRequestArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SpotInstanceRequestArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

SpotInstanceRequest Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The SpotInstanceRequest resource accepts the following input properties:

Ami string

The AMI to use for the instance.

InstanceType string

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

AssociatePublicIpAddress bool

Associate a public ip address with an instance in a VPC. Boolean value.

AvailabilityZone string

The AZ to start the instance in.

BlockDurationMinutes int

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

CpuCoreCount int

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

CpuThreadsPerCore int

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

CreditSpecification SpotInstanceRequestCreditSpecificationArgs

Customize the credit specification of the instance. See Credit Specification below for more details.

DisableApiTermination bool

If true, enables EC2 Instance Termination Protection

EbsBlockDevices List<SpotInstanceRequestEbsBlockDeviceArgs>

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

EbsOptimized bool

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

EphemeralBlockDevices List<SpotInstanceRequestEphemeralBlockDeviceArgs>

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

GetPasswordData bool

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

Hibernation bool

If true, the launched EC2 instance will support hibernation.

HostId string

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

IamInstanceProfile string

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

InstanceInitiatedShutdownBehavior string

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

InstanceInterruptionBehaviour string

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

Ipv6AddressCount int

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

Ipv6Addresses List<string>

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

KeyName string

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

LaunchGroup string

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

MetadataOptions SpotInstanceRequestMetadataOptionsArgs

Customize the metadata options of the instance. See Metadata Options below for more details.

Monitoring bool

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

NetworkInterfaces List<SpotInstanceRequestNetworkInterfaceArgs>

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

PlacementGroup string

The Placement Group to start the instance in.

PrivateIp string

Private IP address to associate with the instance in a VPC.

RootBlockDevice SpotInstanceRequestRootBlockDeviceArgs

Customize details about the root block device of the instance. See Block Devices below for details.

SecurityGroups List<string>

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

SourceDestCheck bool

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

SpotPrice string

The maximum price to request on the spot market.

SpotType string

If set to one-time, after the instance is terminated, the spot request will be closed.

SubnetId string

The VPC Subnet ID to launch in.

Tags Dictionary<string, string>

A map of tags to assign to the resource.

Tenancy string

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

UserData string

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

UserDataBase64 string

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

ValidFrom string

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

ValidUntil string

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

VolumeTags Dictionary<string, string>

A map of tags to assign to the devices created by the instance at launch time.

VpcSecurityGroupIds List<string>

A list of security group IDs to associate with.

WaitForFulfillment bool

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

Ami string

The AMI to use for the instance.

InstanceType string

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

AssociatePublicIpAddress bool

Associate a public ip address with an instance in a VPC. Boolean value.

AvailabilityZone string

The AZ to start the instance in.

BlockDurationMinutes int

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

CpuCoreCount int

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

CpuThreadsPerCore int

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

CreditSpecification SpotInstanceRequestCreditSpecification

Customize the credit specification of the instance. See Credit Specification below for more details.

DisableApiTermination bool

If true, enables EC2 Instance Termination Protection

EbsBlockDevices []SpotInstanceRequestEbsBlockDevice

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

EbsOptimized bool

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

EphemeralBlockDevices []SpotInstanceRequestEphemeralBlockDevice

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

GetPasswordData bool

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

Hibernation bool

If true, the launched EC2 instance will support hibernation.

HostId string

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

IamInstanceProfile string

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

InstanceInitiatedShutdownBehavior string

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

InstanceInterruptionBehaviour string

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

Ipv6AddressCount int

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

Ipv6Addresses []string

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

KeyName string

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

LaunchGroup string

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

MetadataOptions SpotInstanceRequestMetadataOptions

Customize the metadata options of the instance. See Metadata Options below for more details.

Monitoring bool

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

NetworkInterfaces []SpotInstanceRequestNetworkInterface

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

PlacementGroup string

The Placement Group to start the instance in.

PrivateIp string

Private IP address to associate with the instance in a VPC.

RootBlockDevice SpotInstanceRequestRootBlockDevice

Customize details about the root block device of the instance. See Block Devices below for details.

SecurityGroups []string

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

SourceDestCheck bool

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

SpotPrice string

The maximum price to request on the spot market.

SpotType string

If set to one-time, after the instance is terminated, the spot request will be closed.

SubnetId string

The VPC Subnet ID to launch in.

Tags map[string]string

A map of tags to assign to the resource.

Tenancy string

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

UserData string

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

UserDataBase64 string

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

ValidFrom string

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

ValidUntil string

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

VolumeTags map[string]string

A map of tags to assign to the devices created by the instance at launch time.

VpcSecurityGroupIds []string

A list of security group IDs to associate with.

WaitForFulfillment bool

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

ami string

The AMI to use for the instance.

instanceType string

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

associatePublicIpAddress boolean

Associate a public ip address with an instance in a VPC. Boolean value.

availabilityZone string

The AZ to start the instance in.

blockDurationMinutes number

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

cpuCoreCount number

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

cpuThreadsPerCore number

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

creditSpecification SpotInstanceRequestCreditSpecification

Customize the credit specification of the instance. See Credit Specification below for more details.

disableApiTermination boolean

If true, enables EC2 Instance Termination Protection

ebsBlockDevices SpotInstanceRequestEbsBlockDevice[]

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

ebsOptimized boolean

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

ephemeralBlockDevices SpotInstanceRequestEphemeralBlockDevice[]

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

getPasswordData boolean

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

hibernation boolean

If true, the launched EC2 instance will support hibernation.

hostId string

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

iamInstanceProfile string

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

instanceInitiatedShutdownBehavior string

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

instanceInterruptionBehaviour string

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

ipv6AddressCount number

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

ipv6Addresses string[]

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

keyName string

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

launchGroup string

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

metadataOptions SpotInstanceRequestMetadataOptions

Customize the metadata options of the instance. See Metadata Options below for more details.

monitoring boolean

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

networkInterfaces SpotInstanceRequestNetworkInterface[]

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

placementGroup string

The Placement Group to start the instance in.

privateIp string

Private IP address to associate with the instance in a VPC.

rootBlockDevice SpotInstanceRequestRootBlockDevice

Customize details about the root block device of the instance. See Block Devices below for details.

securityGroups string[]

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

sourceDestCheck boolean

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

spotPrice string

The maximum price to request on the spot market.

spotType string

If set to one-time, after the instance is terminated, the spot request will be closed.

subnetId string

The VPC Subnet ID to launch in.

tags {[key: string]: string}

A map of tags to assign to the resource.

tenancy string

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

userData string

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

userDataBase64 string

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

validFrom string

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

validUntil string

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

volumeTags {[key: string]: string}

A map of tags to assign to the devices created by the instance at launch time.

vpcSecurityGroupIds string[]

A list of security group IDs to associate with.

waitForFulfillment boolean

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

ami str

The AMI to use for the instance.

instance_type str

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

associate_public_ip_address bool

Associate a public ip address with an instance in a VPC. Boolean value.

availability_zone str

The AZ to start the instance in.

block_duration_minutes float

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

cpu_core_count float

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

cpu_threads_per_core float

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

credit_specification Dict[SpotInstanceRequestCreditSpecification]

Customize the credit specification of the instance. See Credit Specification below for more details.

disable_api_termination bool

If true, enables EC2 Instance Termination Protection

ebs_block_devices List[SpotInstanceRequestEbsBlockDevice]

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

ebs_optimized bool

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

ephemeral_block_devices List[SpotInstanceRequestEphemeralBlockDevice]

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

get_password_data bool

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

hibernation bool

If true, the launched EC2 instance will support hibernation.

host_id str

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

iam_instance_profile str

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

instance_initiated_shutdown_behavior str

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

instance_interruption_behaviour str

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

ipv6_address_count float

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

ipv6_addresses List[str]

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

key_name str

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

launch_group str

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

metadata_options Dict[SpotInstanceRequestMetadataOptions]

Customize the metadata options of the instance. See Metadata Options below for more details.

monitoring bool

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

network_interfaces List[SpotInstanceRequestNetworkInterface]

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

placement_group str

The Placement Group to start the instance in.

private_ip str

Private IP address to associate with the instance in a VPC.

root_block_device Dict[SpotInstanceRequestRootBlockDevice]

Customize details about the root block device of the instance. See Block Devices below for details.

security_groups List[str]

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

source_dest_check bool

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

spot_price str

The maximum price to request on the spot market.

spot_type str

If set to one-time, after the instance is terminated, the spot request will be closed.

subnet_id str

The VPC Subnet ID to launch in.

tags Dict[str, str]

A map of tags to assign to the resource.

tenancy str

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

user_data str

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

user_data_base64 str

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

valid_from str

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

valid_until str

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

volume_tags Dict[str, str]

A map of tags to assign to the devices created by the instance at launch time.

vpc_security_group_ids List[str]

A list of security group IDs to associate with.

wait_for_fulfillment bool

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

Outputs

All input properties are implicitly available as output properties. Additionally, the SpotInstanceRequest resource produces the following output properties:

Arn string
Id string
The provider-assigned unique ID for this managed resource.
InstanceState string
OutpostArn string
PasswordData string
PrimaryNetworkInterfaceId string
PrivateDns string

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

PublicDns string

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

PublicIp string

The public IP address assigned to the instance, if applicable.

SpotBidStatus string

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

SpotInstanceId string

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

SpotRequestState string
Arn string
Id string
The provider-assigned unique ID for this managed resource.
InstanceState string
OutpostArn string
PasswordData string
PrimaryNetworkInterfaceId string
PrivateDns string

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

PublicDns string

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

PublicIp string

The public IP address assigned to the instance, if applicable.

SpotBidStatus string

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

SpotInstanceId string

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

SpotRequestState string
arn string
id string
The provider-assigned unique ID for this managed resource.
instanceState string
outpostArn string
passwordData string
primaryNetworkInterfaceId string
privateDns string

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

publicDns string

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

publicIp string

The public IP address assigned to the instance, if applicable.

spotBidStatus string

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

spotInstanceId string

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

spotRequestState string
arn str
id str
The provider-assigned unique ID for this managed resource.
instance_state str
outpost_arn str
password_data str
primary_network_interface_id str
private_dns str

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

public_dns str

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

public_ip str

The public IP address assigned to the instance, if applicable.

spot_bid_status str

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

spot_instance_id str

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

spot_request_state str

Look up an Existing SpotInstanceRequest Resource

Get an existing SpotInstanceRequest resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

static get(resource_name, id, opts=None, ami=None, arn=None, associate_public_ip_address=None, availability_zone=None, block_duration_minutes=None, cpu_core_count=None, cpu_threads_per_core=None, credit_specification=None, disable_api_termination=None, ebs_block_devices=None, ebs_optimized=None, ephemeral_block_devices=None, get_password_data=None, hibernation=None, host_id=None, iam_instance_profile=None, instance_initiated_shutdown_behavior=None, instance_interruption_behaviour=None, instance_state=None, instance_type=None, ipv6_address_count=None, ipv6_addresses=None, key_name=None, launch_group=None, metadata_options=None, monitoring=None, network_interfaces=None, outpost_arn=None, password_data=None, placement_group=None, primary_network_interface_id=None, private_dns=None, private_ip=None, public_dns=None, public_ip=None, root_block_device=None, security_groups=None, source_dest_check=None, spot_bid_status=None, spot_instance_id=None, spot_price=None, spot_request_state=None, spot_type=None, subnet_id=None, tags=None, tenancy=None, user_data=None, user_data_base64=None, valid_from=None, valid_until=None, volume_tags=None, vpc_security_group_ids=None, wait_for_fulfillment=None, __props__=None);
func GetSpotInstanceRequest(ctx *Context, name string, id IDInput, state *SpotInstanceRequestState, opts ...ResourceOption) (*SpotInstanceRequest, error)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Ami string

The AMI to use for the instance.

Arn string
AssociatePublicIpAddress bool

Associate a public ip address with an instance in a VPC. Boolean value.

AvailabilityZone string

The AZ to start the instance in.

BlockDurationMinutes int

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

CpuCoreCount int

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

CpuThreadsPerCore int

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

CreditSpecification SpotInstanceRequestCreditSpecificationArgs

Customize the credit specification of the instance. See Credit Specification below for more details.

DisableApiTermination bool

If true, enables EC2 Instance Termination Protection

EbsBlockDevices List<SpotInstanceRequestEbsBlockDeviceArgs>

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

EbsOptimized bool

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

EphemeralBlockDevices List<SpotInstanceRequestEphemeralBlockDeviceArgs>

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

GetPasswordData bool

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

Hibernation bool

If true, the launched EC2 instance will support hibernation.

HostId string

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

IamInstanceProfile string

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

InstanceInitiatedShutdownBehavior string

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

InstanceInterruptionBehaviour string

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

InstanceState string
InstanceType string

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

Ipv6AddressCount int

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

Ipv6Addresses List<string>

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

KeyName string

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

LaunchGroup string

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

MetadataOptions SpotInstanceRequestMetadataOptionsArgs

Customize the metadata options of the instance. See Metadata Options below for more details.

Monitoring bool

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

NetworkInterfaces List<SpotInstanceRequestNetworkInterfaceArgs>

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

OutpostArn string
PasswordData string
PlacementGroup string

The Placement Group to start the instance in.

PrimaryNetworkInterfaceId string
PrivateDns string

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

PrivateIp string

Private IP address to associate with the instance in a VPC.

PublicDns string

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

PublicIp string

The public IP address assigned to the instance, if applicable.

RootBlockDevice SpotInstanceRequestRootBlockDeviceArgs

Customize details about the root block device of the instance. See Block Devices below for details.

SecurityGroups List<string>

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

SourceDestCheck bool

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

SpotBidStatus string

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

SpotInstanceId string

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

SpotPrice string

The maximum price to request on the spot market.

SpotRequestState string
SpotType string

If set to one-time, after the instance is terminated, the spot request will be closed.

SubnetId string

The VPC Subnet ID to launch in.

Tags Dictionary<string, string>

A map of tags to assign to the resource.

Tenancy string

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

UserData string

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

UserDataBase64 string

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

ValidFrom string

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

ValidUntil string

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

VolumeTags Dictionary<string, string>

A map of tags to assign to the devices created by the instance at launch time.

VpcSecurityGroupIds List<string>

A list of security group IDs to associate with.

WaitForFulfillment bool

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

Ami string

The AMI to use for the instance.

Arn string
AssociatePublicIpAddress bool

Associate a public ip address with an instance in a VPC. Boolean value.

AvailabilityZone string

The AZ to start the instance in.

BlockDurationMinutes int

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

CpuCoreCount int

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

CpuThreadsPerCore int

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

CreditSpecification SpotInstanceRequestCreditSpecification

Customize the credit specification of the instance. See Credit Specification below for more details.

DisableApiTermination bool

If true, enables EC2 Instance Termination Protection

EbsBlockDevices []SpotInstanceRequestEbsBlockDevice

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

EbsOptimized bool

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

EphemeralBlockDevices []SpotInstanceRequestEphemeralBlockDevice

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

GetPasswordData bool

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

Hibernation bool

If true, the launched EC2 instance will support hibernation.

HostId string

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

IamInstanceProfile string

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

InstanceInitiatedShutdownBehavior string

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

InstanceInterruptionBehaviour string

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

InstanceState string
InstanceType string

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

Ipv6AddressCount int

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

Ipv6Addresses []string

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

KeyName string

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

LaunchGroup string

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

MetadataOptions SpotInstanceRequestMetadataOptions

Customize the metadata options of the instance. See Metadata Options below for more details.

Monitoring bool

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

NetworkInterfaces []SpotInstanceRequestNetworkInterface

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

OutpostArn string
PasswordData string
PlacementGroup string

The Placement Group to start the instance in.

PrimaryNetworkInterfaceId string
PrivateDns string

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

PrivateIp string

Private IP address to associate with the instance in a VPC.

PublicDns string

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

PublicIp string

The public IP address assigned to the instance, if applicable.

RootBlockDevice SpotInstanceRequestRootBlockDevice

Customize details about the root block device of the instance. See Block Devices below for details.

SecurityGroups []string

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

SourceDestCheck bool

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

SpotBidStatus string

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

SpotInstanceId string

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

SpotPrice string

The maximum price to request on the spot market.

SpotRequestState string
SpotType string

If set to one-time, after the instance is terminated, the spot request will be closed.

SubnetId string

The VPC Subnet ID to launch in.

Tags map[string]string

A map of tags to assign to the resource.

Tenancy string

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

UserData string

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

UserDataBase64 string

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

ValidFrom string

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

ValidUntil string

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

VolumeTags map[string]string

A map of tags to assign to the devices created by the instance at launch time.

VpcSecurityGroupIds []string

A list of security group IDs to associate with.

WaitForFulfillment bool

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

ami string

The AMI to use for the instance.

arn string
associatePublicIpAddress boolean

Associate a public ip address with an instance in a VPC. Boolean value.

availabilityZone string

The AZ to start the instance in.

blockDurationMinutes number

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

cpuCoreCount number

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

cpuThreadsPerCore number

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

creditSpecification SpotInstanceRequestCreditSpecification

Customize the credit specification of the instance. See Credit Specification below for more details.

disableApiTermination boolean

If true, enables EC2 Instance Termination Protection

ebsBlockDevices SpotInstanceRequestEbsBlockDevice[]

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

ebsOptimized boolean

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

ephemeralBlockDevices SpotInstanceRequestEphemeralBlockDevice[]

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

getPasswordData boolean

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

hibernation boolean

If true, the launched EC2 instance will support hibernation.

hostId string

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

iamInstanceProfile string

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

instanceInitiatedShutdownBehavior string

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

instanceInterruptionBehaviour string

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

instanceState string
instanceType string

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

ipv6AddressCount number

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

ipv6Addresses string[]

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

keyName string

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

launchGroup string

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

metadataOptions SpotInstanceRequestMetadataOptions

Customize the metadata options of the instance. See Metadata Options below for more details.

monitoring boolean

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

networkInterfaces SpotInstanceRequestNetworkInterface[]

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

outpostArn string
passwordData string
placementGroup string

The Placement Group to start the instance in.

primaryNetworkInterfaceId string
privateDns string

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

privateIp string

Private IP address to associate with the instance in a VPC.

publicDns string

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

publicIp string

The public IP address assigned to the instance, if applicable.

rootBlockDevice SpotInstanceRequestRootBlockDevice

Customize details about the root block device of the instance. See Block Devices below for details.

securityGroups string[]

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

sourceDestCheck boolean

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

spotBidStatus string

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

spotInstanceId string

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

spotPrice string

The maximum price to request on the spot market.

spotRequestState string
spotType string

If set to one-time, after the instance is terminated, the spot request will be closed.

subnetId string

The VPC Subnet ID to launch in.

tags {[key: string]: string}

A map of tags to assign to the resource.

tenancy string

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

userData string

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

userDataBase64 string

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

validFrom string

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

validUntil string

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

volumeTags {[key: string]: string}

A map of tags to assign to the devices created by the instance at launch time.

vpcSecurityGroupIds string[]

A list of security group IDs to associate with.

waitForFulfillment boolean

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

ami str

The AMI to use for the instance.

arn str
associate_public_ip_address bool

Associate a public ip address with an instance in a VPC. Boolean value.

availability_zone str

The AZ to start the instance in.

block_duration_minutes float

The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates. Note that you can’t specify an Availability Zone group or a launch group if you specify a duration.

cpu_core_count float

Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.

cpu_threads_per_core float

If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.

credit_specification Dict[SpotInstanceRequestCreditSpecification]

Customize the credit specification of the instance. See Credit Specification below for more details.

disable_api_termination bool

If true, enables EC2 Instance Termination Protection

ebs_block_devices List[SpotInstanceRequestEbsBlockDevice]

Additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection.

ebs_optimized bool

If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.

ephemeral_block_devices List[SpotInstanceRequestEphemeralBlockDevice]

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

get_password_data bool

If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the password_data attribute. See GetPasswordData for more information.

hibernation bool

If true, the launched EC2 instance will support hibernation.

host_id str

The Id of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.

iam_instance_profile str

The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably iam:PassRole.

instance_initiated_shutdown_behavior str

Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.

instance_interruption_behaviour str

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate as this is the current AWS behaviour.

instance_state str
instance_type str

The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.

ipv6_address_count float

A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.

ipv6_addresses List[str]

Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface

key_name str

The key name of the Key Pair to use for the instance; which can be managed using the aws.ec2.KeyPair resource.

launch_group str

A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually.

metadata_options Dict[SpotInstanceRequestMetadataOptions]

Customize the metadata options of the instance. See Metadata Options below for more details.

monitoring bool

If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)

network_interfaces List[SpotInstanceRequestNetworkInterface]

Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.

outpost_arn str
password_data str
placement_group str

The Placement Group to start the instance in.

primary_network_interface_id str
private_dns str

The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you’ve enabled DNS hostnames for your VPC

private_ip str

Private IP address to associate with the instance in a VPC.

public_dns str

The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC

public_ip str

The public IP address assigned to the instance, if applicable.

root_block_device Dict[SpotInstanceRequestRootBlockDevice]

Customize details about the root block device of the instance. See Block Devices below for details.

security_groups List[str]

A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.

source_dest_check bool

Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.

spot_bid_status str

The current bid status of the Spot Instance Request. * spot_request_state The current request state of the Spot Instance Request.

spot_instance_id str

The Instance ID (if any) that is currently fulfilling the Spot Instance request.

spot_price str

The maximum price to request on the spot market.

spot_request_state str
spot_type str

If set to one-time, after the instance is terminated, the spot request will be closed.

subnet_id str

The VPC Subnet ID to launch in.

tags Dict[str, str]

A map of tags to assign to the resource.

tenancy str

The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.

user_data str

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

user_data_base64 str

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

valid_from str

The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.

valid_until str

The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date.

volume_tags Dict[str, str]

A map of tags to assign to the devices created by the instance at launch time.

vpc_security_group_ids List[str]

A list of security group IDs to associate with.

wait_for_fulfillment bool

If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.

Supporting Types

SpotInstanceRequestCreditSpecification

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

CpuCredits string

The credit option for CPU usage. Can be "standard" or "unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.

CpuCredits string

The credit option for CPU usage. Can be "standard" or "unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.

cpuCredits string

The credit option for CPU usage. Can be "standard" or "unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.

cpuCredits str

The credit option for CPU usage. Can be "standard" or "unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.

SpotInstanceRequestEbsBlockDevice

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DeviceName string

The name of the device to mount.

DeleteOnTermination bool

Whether the volume should be destroyed on instance termination (Default: true).

Encrypted bool

Enables EBS encryption on the volume (Default: false). Cannot be used with snapshot_id. Must be configured to perform drift detection.

Iops int

The amount of provisioned IOPS. This must be set with a volume_type of "io1".

KmsKeyId string

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

SnapshotId string

The Snapshot ID to mount.

VolumeId string
VolumeSize int

The size of the volume in gibibytes (GiB).

VolumeType string

The type of volume. Can be "standard", "gp2", or "io1". (Default: "gp2").

DeviceName string

The name of the device to mount.

DeleteOnTermination bool

Whether the volume should be destroyed on instance termination (Default: true).

Encrypted bool

Enables EBS encryption on the volume (Default: false). Cannot be used with snapshot_id. Must be configured to perform drift detection.

Iops int

The amount of provisioned IOPS. This must be set with a volume_type of "io1".

KmsKeyId string

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

SnapshotId string

The Snapshot ID to mount.

VolumeId string
VolumeSize int

The size of the volume in gibibytes (GiB).

VolumeType string

The type of volume. Can be "standard", "gp2", or "io1". (Default: "gp2").

deviceName string

The name of the device to mount.

deleteOnTermination boolean

Whether the volume should be destroyed on instance termination (Default: true).

encrypted boolean

Enables EBS encryption on the volume (Default: false). Cannot be used with snapshot_id. Must be configured to perform drift detection.

iops number

The amount of provisioned IOPS. This must be set with a volume_type of "io1".

kmsKeyId string

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

snapshotId string

The Snapshot ID to mount.

volumeId string
volumeSize number

The size of the volume in gibibytes (GiB).

volumeType string

The type of volume. Can be "standard", "gp2", or "io1". (Default: "gp2").

device_name str

The name of the device to mount.

deleteOnTermination bool

Whether the volume should be destroyed on instance termination (Default: true).

encrypted bool

Enables EBS encryption on the volume (Default: false). Cannot be used with snapshot_id. Must be configured to perform drift detection.

iops float

The amount of provisioned IOPS. This must be set with a volume_type of "io1".

kms_key_id str

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

snapshot_id str

The Snapshot ID to mount.

volumeType str

The type of volume. Can be "standard", "gp2", or "io1". (Default: "gp2").

volume_id str
volume_size float

The size of the volume in gibibytes (GiB).

SpotInstanceRequestEphemeralBlockDevice

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DeviceName string

The name of the block device to mount on the instance.

NoDevice bool

Suppresses the specified device included in the AMI’s block device mapping.

VirtualName string

The Instance Store Device Name (e.g. "ephemeral0").

DeviceName string

The name of the block device to mount on the instance.

NoDevice bool

Suppresses the specified device included in the AMI’s block device mapping.

VirtualName string

The Instance Store Device Name (e.g. "ephemeral0").

deviceName string

The name of the block device to mount on the instance.

noDevice boolean

Suppresses the specified device included in the AMI’s block device mapping.

virtualName string

The Instance Store Device Name (e.g. "ephemeral0").

device_name str

The name of the block device to mount on the instance.

noDevice bool

Suppresses the specified device included in the AMI’s block device mapping.

virtualName str

The Instance Store Device Name (e.g. "ephemeral0").

SpotInstanceRequestMetadataOptions

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

HttpEndpoint string

Whether the metadata service is available. Can be "enabled" or "disabled". (Default: "enabled").

HttpPutResponseHopLimit int

The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64. (Default: 1).

HttpTokens string

Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be "optional" or "required". (Default: "optional").

HttpEndpoint string

Whether the metadata service is available. Can be "enabled" or "disabled". (Default: "enabled").

HttpPutResponseHopLimit int

The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64. (Default: 1).

HttpTokens string

Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be "optional" or "required". (Default: "optional").

httpEndpoint string

Whether the metadata service is available. Can be "enabled" or "disabled". (Default: "enabled").

httpPutResponseHopLimit number

The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64. (Default: 1).

httpTokens string

Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be "optional" or "required". (Default: "optional").

httpEndpoint str

Whether the metadata service is available. Can be "enabled" or "disabled". (Default: "enabled").

httpPutResponseHopLimit float

The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64. (Default: 1).

httpTokens str

Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be "optional" or "required". (Default: "optional").

SpotInstanceRequestNetworkInterface

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DeviceIndex int

The integer index of the network interface attachment. Limited by instance type.

NetworkInterfaceId string

The ID of the network interface to attach.

DeleteOnTermination bool

Whether or not to delete the network interface on instance termination. Defaults to false. Currently, the only valid value is false, as this is only supported when creating new network interfaces when launching an instance.

DeviceIndex int

The integer index of the network interface attachment. Limited by instance type.

NetworkInterfaceId string

The ID of the network interface to attach.

DeleteOnTermination bool

Whether or not to delete the network interface on instance termination. Defaults to false. Currently, the only valid value is false, as this is only supported when creating new network interfaces when launching an instance.

deviceIndex number

The integer index of the network interface attachment. Limited by instance type.

networkInterfaceId string

The ID of the network interface to attach.

deleteOnTermination boolean

Whether or not to delete the network interface on instance termination. Defaults to false. Currently, the only valid value is false, as this is only supported when creating new network interfaces when launching an instance.

device_index float

The integer index of the network interface attachment. Limited by instance type.

network_interface_id str

The ID of the network interface to attach.

deleteOnTermination bool

Whether or not to delete the network interface on instance termination. Defaults to false. Currently, the only valid value is false, as this is only supported when creating new network interfaces when launching an instance.

SpotInstanceRequestRootBlockDevice

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DeleteOnTermination bool

Whether the volume should be destroyed on instance termination (Default: true).

DeviceName string

The name of the device to mount.

Encrypted bool

Enable volume encryption. (Default: false). Must be configured to perform drift detection.

Iops int

The amount of provisioned IOPS. This is only valid for volume_type of "io1", and must be specified if using that type

KmsKeyId string

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

VolumeId string
VolumeSize int

The size of the volume in gibibytes (GiB).

VolumeType string

The type of volume. Can be "standard", "gp2", "io1", "sc1", or "st1". (Default: "standard").

DeleteOnTermination bool

Whether the volume should be destroyed on instance termination (Default: true).

DeviceName string

The name of the device to mount.

Encrypted bool

Enable volume encryption. (Default: false). Must be configured to perform drift detection.

Iops int

The amount of provisioned IOPS. This is only valid for volume_type of "io1", and must be specified if using that type

KmsKeyId string

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

VolumeId string
VolumeSize int

The size of the volume in gibibytes (GiB).

VolumeType string

The type of volume. Can be "standard", "gp2", "io1", "sc1", or "st1". (Default: "standard").

deleteOnTermination boolean

Whether the volume should be destroyed on instance termination (Default: true).

deviceName string

The name of the device to mount.

encrypted boolean

Enable volume encryption. (Default: false). Must be configured to perform drift detection.

iops number

The amount of provisioned IOPS. This is only valid for volume_type of "io1", and must be specified if using that type

kmsKeyId string

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

volumeId string
volumeSize number

The size of the volume in gibibytes (GiB).

volumeType string

The type of volume. Can be "standard", "gp2", "io1", "sc1", or "st1". (Default: "standard").

deleteOnTermination bool

Whether the volume should be destroyed on instance termination (Default: true).

device_name str

The name of the device to mount.

encrypted bool

Enable volume encryption. (Default: false). Must be configured to perform drift detection.

iops float

The amount of provisioned IOPS. This is only valid for volume_type of "io1", and must be specified if using that type

kms_key_id str

Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.

volumeType str

The type of volume. Can be "standard", "gp2", "io1", "sc1", or "st1". (Default: "standard").

volume_id str
volume_size float

The size of the volume in gibibytes (GiB).

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.