SpotInstanceRequestArgs

data class SpotInstanceRequestArgs(val ami: Output<String>? = null, val associatePublicIpAddress: Output<Boolean>? = null, val availabilityZone: Output<String>? = null, val blockDurationMinutes: Output<Int>? = null, val capacityReservationSpecification: Output<SpotInstanceRequestCapacityReservationSpecificationArgs>? = null, val cpuCoreCount: Output<Int>? = null, val cpuOptions: Output<SpotInstanceRequestCpuOptionsArgs>? = null, val cpuThreadsPerCore: Output<Int>? = null, val creditSpecification: Output<SpotInstanceRequestCreditSpecificationArgs>? = null, val disableApiStop: Output<Boolean>? = null, val disableApiTermination: Output<Boolean>? = null, val ebsBlockDevices: Output<List<SpotInstanceRequestEbsBlockDeviceArgs>>? = null, val ebsOptimized: Output<Boolean>? = null, val enclaveOptions: Output<SpotInstanceRequestEnclaveOptionsArgs>? = null, val ephemeralBlockDevices: Output<List<SpotInstanceRequestEphemeralBlockDeviceArgs>>? = null, val getPasswordData: Output<Boolean>? = null, val hibernation: Output<Boolean>? = null, val hostId: Output<String>? = null, val hostResourceGroupArn: Output<String>? = null, val iamInstanceProfile: Output<String>? = null, val instanceInitiatedShutdownBehavior: Output<String>? = null, val instanceInterruptionBehavior: Output<String>? = null, val instanceType: Output<String>? = null, val ipv6AddressCount: Output<Int>? = null, val ipv6Addresses: Output<List<String>>? = null, val keyName: Output<String>? = null, val launchGroup: Output<String>? = null, val launchTemplate: Output<SpotInstanceRequestLaunchTemplateArgs>? = null, val maintenanceOptions: Output<SpotInstanceRequestMaintenanceOptionsArgs>? = null, val metadataOptions: Output<SpotInstanceRequestMetadataOptionsArgs>? = null, val monitoring: Output<Boolean>? = null, val networkInterfaces: Output<List<SpotInstanceRequestNetworkInterfaceArgs>>? = null, val placementGroup: Output<String>? = null, val placementPartitionNumber: Output<Int>? = null, val privateDnsNameOptions: Output<SpotInstanceRequestPrivateDnsNameOptionsArgs>? = null, val privateIp: Output<String>? = null, val rootBlockDevice: Output<SpotInstanceRequestRootBlockDeviceArgs>? = null, val secondaryPrivateIps: Output<List<String>>? = null, val securityGroups: Output<List<String>>? = null, val sourceDestCheck: Output<Boolean>? = null, val spotPrice: Output<String>? = null, val spotType: Output<String>? = null, val subnetId: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val tenancy: Output<String>? = null, val userData: Output<String>? = null, val userDataBase64: Output<String>? = null, val userDataReplaceOnChange: Output<Boolean>? = null, val validFrom: Output<String>? = null, val validUntil: Output<String>? = null, val volumeTags: Output<Map<String, String>>? = null, val vpcSecurityGroupIds: Output<List<String>>? = null, val waitForFulfillment: Output<Boolean>? = null) : ConvertibleToJava<SpotInstanceRequestArgs>

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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html) for more information.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.SpotInstanceRequest;
import com.pulumi.aws.ec2.SpotInstanceRequestArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var cheapWorker = new SpotInstanceRequest("cheapWorker", SpotInstanceRequestArgs.builder()
.ami("ami-1234")
.instanceType("c4.xlarge")
.spotPrice("0.03")
.tags(Map.of("Name", "CheapWorker"))
.build());
}
}

Constructors

Link copied to clipboard
constructor(ami: Output<String>? = null, associatePublicIpAddress: Output<Boolean>? = null, availabilityZone: Output<String>? = null, blockDurationMinutes: Output<Int>? = null, capacityReservationSpecification: Output<SpotInstanceRequestCapacityReservationSpecificationArgs>? = null, cpuCoreCount: Output<Int>? = null, cpuOptions: Output<SpotInstanceRequestCpuOptionsArgs>? = null, cpuThreadsPerCore: Output<Int>? = null, creditSpecification: Output<SpotInstanceRequestCreditSpecificationArgs>? = null, disableApiStop: Output<Boolean>? = null, disableApiTermination: Output<Boolean>? = null, ebsBlockDevices: Output<List<SpotInstanceRequestEbsBlockDeviceArgs>>? = null, ebsOptimized: Output<Boolean>? = null, enclaveOptions: Output<SpotInstanceRequestEnclaveOptionsArgs>? = null, ephemeralBlockDevices: Output<List<SpotInstanceRequestEphemeralBlockDeviceArgs>>? = null, getPasswordData: Output<Boolean>? = null, hibernation: Output<Boolean>? = null, hostId: Output<String>? = null, hostResourceGroupArn: Output<String>? = null, iamInstanceProfile: Output<String>? = null, instanceInitiatedShutdownBehavior: Output<String>? = null, instanceInterruptionBehavior: Output<String>? = null, instanceType: Output<String>? = null, ipv6AddressCount: Output<Int>? = null, ipv6Addresses: Output<List<String>>? = null, keyName: Output<String>? = null, launchGroup: Output<String>? = null, launchTemplate: Output<SpotInstanceRequestLaunchTemplateArgs>? = null, maintenanceOptions: Output<SpotInstanceRequestMaintenanceOptionsArgs>? = null, metadataOptions: Output<SpotInstanceRequestMetadataOptionsArgs>? = null, monitoring: Output<Boolean>? = null, networkInterfaces: Output<List<SpotInstanceRequestNetworkInterfaceArgs>>? = null, placementGroup: Output<String>? = null, placementPartitionNumber: Output<Int>? = null, privateDnsNameOptions: Output<SpotInstanceRequestPrivateDnsNameOptionsArgs>? = null, privateIp: Output<String>? = null, rootBlockDevice: Output<SpotInstanceRequestRootBlockDeviceArgs>? = null, secondaryPrivateIps: Output<List<String>>? = null, securityGroups: Output<List<String>>? = null, sourceDestCheck: Output<Boolean>? = null, spotPrice: Output<String>? = null, spotType: Output<String>? = null, subnetId: Output<String>? = null, tags: Output<Map<String, String>>? = null, tenancy: Output<String>? = null, userData: Output<String>? = null, userDataBase64: Output<String>? = null, userDataReplaceOnChange: Output<Boolean>? = null, validFrom: Output<String>? = null, validUntil: Output<String>? = null, volumeTags: Output<Map<String, String>>? = null, vpcSecurityGroupIds: Output<List<String>>? = null, waitForFulfillment: Output<Boolean>? = null)

Properties

Link copied to clipboard
val ami: Output<String>? = null

AMI to use for the instance. Required unless launch_template is specified and the Launch Template specifes an AMI. If an AMI is specified in the Launch Template, setting ami will override the AMI specified in the Launch Template.

Link copied to clipboard
val associatePublicIpAddress: Output<Boolean>? = null

Whether to associate a public IP address with an instance in a VPC.

Link copied to clipboard
val availabilityZone: Output<String>? = null

AZ to start the instance in.

Link copied to clipboard
val blockDurationMinutes: Output<Int>? = null

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.

Link copied to clipboard

Describes an instance's Capacity Reservation targeting option. See Capacity Reservation Specification below for more details.

Link copied to clipboard
val cpuCoreCount: Output<Int>? = null

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.

Link copied to clipboard

The CPU options for the instance. See CPU Options below for more details.

Link copied to clipboard
val cpuThreadsPerCore: Output<Int>? = null

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

Link copied to clipboard

Configuration block for customizing the credit specification of the instance. See Credit Specification below for more details. This provider will only perform drift detection of its value when present in a configuration. Removing this configuration on existing instances will only stop managing it. It will not change the configuration back to the default for the instance type.

Link copied to clipboard
val disableApiStop: Output<Boolean>? = null
Link copied to clipboard
Link copied to clipboard

One or more configuration blocks with 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. When accessing this as an attribute reference, it is a set of objects.

Link copied to clipboard
val ebsOptimized: Output<Boolean>? = null

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.

Link copied to clipboard

Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.

Link copied to clipboard

One or more configuration blocks to customize Ephemeral (also known as "Instance Store") volumes on the instance. See Block Devices below for details. When accessing this as an attribute reference, it is a set of objects.

Link copied to clipboard
val getPasswordData: Output<Boolean>? = null

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.

Link copied to clipboard
val hibernation: Output<Boolean>? = null

If true, the launched EC2 instance will support hibernation.

Link copied to clipboard
val hostId: Output<String>? = null

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.

Link copied to clipboard
val hostResourceGroupArn: Output<String>? = null

ARN of the host resource group in which to launch the instances. If you specify an ARN, omit the tenancy parameter or set it to host.

Link copied to clipboard
val iamInstanceProfile: Output<String>? = null

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.

Link copied to clipboard

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.

Link copied to clipboard

Indicates Spot instance behavior when it is interrupted. Valid values are terminate, stop, or hibernate. Default value is terminate.

Link copied to clipboard
val instanceType: Output<String>? = null

Instance type to use for the instance. Required unless launch_template is specified and the Launch Template specifies an instance type. If an instance type is specified in the Launch Template, setting instance_type will override the instance type specified in the Launch Template. Updates to this field will trigger a stop/start of the EC2 instance.

Link copied to clipboard
val ipv6AddressCount: Output<Int>? = null

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

Link copied to clipboard
val ipv6Addresses: Output<List<String>>? = null

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

Link copied to clipboard
val keyName: Output<String>? = null

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

Link copied to clipboard
val launchGroup: Output<String>? = null

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

Link copied to clipboard

Specifies a Launch Template to configure the instance. Parameters configured on this resource will override the corresponding parameters in the Launch Template. See Launch Template Specification below for more details.

Link copied to clipboard

Maintenance and recovery options for the instance. See Maintenance Options below for more details.

Link copied to clipboard

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

Link copied to clipboard
val monitoring: Output<Boolean>? = null

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

Link copied to clipboard

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

Link copied to clipboard
val placementGroup: Output<String>? = null

Placement Group to start the instance in.

Link copied to clipboard
val placementPartitionNumber: Output<Int>? = null

Number of the partition the instance is in. Valid only if the aws.ec2.PlacementGroup resource's strategy argument is set to "partition".

Link copied to clipboard

Options for the instance hostname. The default values are inherited from the subnet. See Private DNS Name Options below for more details.

Link copied to clipboard
val privateIp: Output<String>? = null

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

Link copied to clipboard

Configuration block to customize details about the root block device of the instance. See Block Devices below for details. When accessing this as an attribute reference, it is a list containing one object.

Link copied to clipboard
val secondaryPrivateIps: Output<List<String>>? = null

List of secondary private IPv4 addresses to assign to the instance's primary network interface (eth0) in a VPC. Can only be assigned to the primary network interface (eth0) attached at instance creation, not a pre-existing network interface i.e., referenced in a network_interface block. Refer to the Elastic network interfaces documentation to see the maximum number of private IP addresses allowed per instance type.

Link copied to clipboard
val securityGroups: Output<List<String>>? = null

List of security group names to associate with.

Link copied to clipboard
val sourceDestCheck: Output<Boolean>? = null

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

Link copied to clipboard
val spotPrice: Output<String>? = null

The maximum price to request on the spot market.

Link copied to clipboard
val spotType: Output<String>? = null

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

Link copied to clipboard
val subnetId: Output<String>? = null

VPC Subnet ID to launch in.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Map of tags to assign to the resource. Note that these tags apply to the instance and not block storage devices. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tenancy: Output<String>? = null

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. Valid values are default, dedicated, and host.

Link copied to clipboard
val userData: Output<String>? = null

User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead. Updates to this field will trigger a stop/start of the EC2 instance by default. If the user_data_replace_on_change is set then updates to this field will trigger a destroy and recreate.

Link copied to clipboard
val userDataBase64: Output<String>? = null

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. Updates to this field will trigger a stop/start of the EC2 instance by default. If the user_data_replace_on_change is set then updates to this field will trigger a destroy and recreate.

Link copied to clipboard
val userDataReplaceOnChange: Output<Boolean>? = null

When used in combination with user_data or user_data_base64 will trigger a destroy and recreate when set to true. Defaults to false if not set.

Link copied to clipboard
val validFrom: Output<String>? = null

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.

Link copied to clipboard
val validUntil: Output<String>? = null

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.

Link copied to clipboard
val volumeTags: Output<Map<String, String>>? = null

Map of tags to assign, at instance-creation time, to root and EBS volumes.

Link copied to clipboard
val vpcSecurityGroupIds: Output<List<String>>? = null

List of security group IDs to associate with.

Link copied to clipboard
val waitForFulfillment: Output<Boolean>? = null

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.

Functions

Link copied to clipboard
open override fun toJava(): SpotInstanceRequestArgs