UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

221 lines • 15.2 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.SpotInstanceRequest = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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. * * > **NOTE [AWS strongly discourages](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-best-practices.html#which-spot-request-method-to-use) the use of the legacy APIs called by this resource. * We recommend using the EC2 Instance resource with `instanceMarketOptions` instead. * * ## Example Usage * * ```typescript * 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", * spotPrice: "0.03", * instanceType: "c4.xlarge", * tags: { * Name: "CheapWorker", * }, * }); * ``` */ class SpotInstanceRequest extends pulumi.CustomResource { /** * Get an existing SpotInstanceRequest resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new SpotInstanceRequest(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SpotInstanceRequest. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === SpotInstanceRequest.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["ami"] = state ? state.ami : undefined; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["associatePublicIpAddress"] = state ? state.associatePublicIpAddress : undefined; resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined; resourceInputs["capacityReservationSpecification"] = state ? state.capacityReservationSpecification : undefined; resourceInputs["cpuOptions"] = state ? state.cpuOptions : undefined; resourceInputs["creditSpecification"] = state ? state.creditSpecification : undefined; resourceInputs["disableApiStop"] = state ? state.disableApiStop : undefined; resourceInputs["disableApiTermination"] = state ? state.disableApiTermination : undefined; resourceInputs["ebsBlockDevices"] = state ? state.ebsBlockDevices : undefined; resourceInputs["ebsOptimized"] = state ? state.ebsOptimized : undefined; resourceInputs["enablePrimaryIpv6"] = state ? state.enablePrimaryIpv6 : undefined; resourceInputs["enclaveOptions"] = state ? state.enclaveOptions : undefined; resourceInputs["ephemeralBlockDevices"] = state ? state.ephemeralBlockDevices : undefined; resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined; resourceInputs["getPasswordData"] = state ? state.getPasswordData : undefined; resourceInputs["hibernation"] = state ? state.hibernation : undefined; resourceInputs["hostId"] = state ? state.hostId : undefined; resourceInputs["hostResourceGroupArn"] = state ? state.hostResourceGroupArn : undefined; resourceInputs["iamInstanceProfile"] = state ? state.iamInstanceProfile : undefined; resourceInputs["instanceInitiatedShutdownBehavior"] = state ? state.instanceInitiatedShutdownBehavior : undefined; resourceInputs["instanceInterruptionBehavior"] = state ? state.instanceInterruptionBehavior : undefined; resourceInputs["instanceState"] = state ? state.instanceState : undefined; resourceInputs["instanceType"] = state ? state.instanceType : undefined; resourceInputs["ipv6AddressCount"] = state ? state.ipv6AddressCount : undefined; resourceInputs["ipv6Addresses"] = state ? state.ipv6Addresses : undefined; resourceInputs["keyName"] = state ? state.keyName : undefined; resourceInputs["launchGroup"] = state ? state.launchGroup : undefined; resourceInputs["launchTemplate"] = state ? state.launchTemplate : undefined; resourceInputs["maintenanceOptions"] = state ? state.maintenanceOptions : undefined; resourceInputs["metadataOptions"] = state ? state.metadataOptions : undefined; resourceInputs["monitoring"] = state ? state.monitoring : undefined; resourceInputs["networkInterfaces"] = state ? state.networkInterfaces : undefined; resourceInputs["outpostArn"] = state ? state.outpostArn : undefined; resourceInputs["passwordData"] = state ? state.passwordData : undefined; resourceInputs["placementGroup"] = state ? state.placementGroup : undefined; resourceInputs["placementPartitionNumber"] = state ? state.placementPartitionNumber : undefined; resourceInputs["primaryNetworkInterfaceId"] = state ? state.primaryNetworkInterfaceId : undefined; resourceInputs["privateDns"] = state ? state.privateDns : undefined; resourceInputs["privateDnsNameOptions"] = state ? state.privateDnsNameOptions : undefined; resourceInputs["privateIp"] = state ? state.privateIp : undefined; resourceInputs["publicDns"] = state ? state.publicDns : undefined; resourceInputs["publicIp"] = state ? state.publicIp : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["rootBlockDevice"] = state ? state.rootBlockDevice : undefined; resourceInputs["secondaryPrivateIps"] = state ? state.secondaryPrivateIps : undefined; resourceInputs["securityGroups"] = state ? state.securityGroups : undefined; resourceInputs["sourceDestCheck"] = state ? state.sourceDestCheck : undefined; resourceInputs["spotBidStatus"] = state ? state.spotBidStatus : undefined; resourceInputs["spotInstanceId"] = state ? state.spotInstanceId : undefined; resourceInputs["spotPrice"] = state ? state.spotPrice : undefined; resourceInputs["spotRequestState"] = state ? state.spotRequestState : undefined; resourceInputs["spotType"] = state ? state.spotType : undefined; resourceInputs["subnetId"] = state ? state.subnetId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["tenancy"] = state ? state.tenancy : undefined; resourceInputs["userData"] = state ? state.userData : undefined; resourceInputs["userDataBase64"] = state ? state.userDataBase64 : undefined; resourceInputs["userDataReplaceOnChange"] = state ? state.userDataReplaceOnChange : undefined; resourceInputs["validFrom"] = state ? state.validFrom : undefined; resourceInputs["validUntil"] = state ? state.validUntil : undefined; resourceInputs["volumeTags"] = state ? state.volumeTags : undefined; resourceInputs["vpcSecurityGroupIds"] = state ? state.vpcSecurityGroupIds : undefined; resourceInputs["waitForFulfillment"] = state ? state.waitForFulfillment : undefined; } else { const args = argsOrState; resourceInputs["ami"] = args ? args.ami : undefined; resourceInputs["associatePublicIpAddress"] = args ? args.associatePublicIpAddress : undefined; resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined; resourceInputs["capacityReservationSpecification"] = args ? args.capacityReservationSpecification : undefined; resourceInputs["cpuOptions"] = args ? args.cpuOptions : undefined; resourceInputs["creditSpecification"] = args ? args.creditSpecification : undefined; resourceInputs["disableApiStop"] = args ? args.disableApiStop : undefined; resourceInputs["disableApiTermination"] = args ? args.disableApiTermination : undefined; resourceInputs["ebsBlockDevices"] = args ? args.ebsBlockDevices : undefined; resourceInputs["ebsOptimized"] = args ? args.ebsOptimized : undefined; resourceInputs["enablePrimaryIpv6"] = args ? args.enablePrimaryIpv6 : undefined; resourceInputs["enclaveOptions"] = args ? args.enclaveOptions : undefined; resourceInputs["ephemeralBlockDevices"] = args ? args.ephemeralBlockDevices : undefined; resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined; resourceInputs["getPasswordData"] = args ? args.getPasswordData : undefined; resourceInputs["hibernation"] = args ? args.hibernation : undefined; resourceInputs["hostId"] = args ? args.hostId : undefined; resourceInputs["hostResourceGroupArn"] = args ? args.hostResourceGroupArn : undefined; resourceInputs["iamInstanceProfile"] = args ? args.iamInstanceProfile : undefined; resourceInputs["instanceInitiatedShutdownBehavior"] = args ? args.instanceInitiatedShutdownBehavior : undefined; resourceInputs["instanceInterruptionBehavior"] = args ? args.instanceInterruptionBehavior : undefined; resourceInputs["instanceType"] = args ? args.instanceType : undefined; resourceInputs["ipv6AddressCount"] = args ? args.ipv6AddressCount : undefined; resourceInputs["ipv6Addresses"] = args ? args.ipv6Addresses : undefined; resourceInputs["keyName"] = args ? args.keyName : undefined; resourceInputs["launchGroup"] = args ? args.launchGroup : undefined; resourceInputs["launchTemplate"] = args ? args.launchTemplate : undefined; resourceInputs["maintenanceOptions"] = args ? args.maintenanceOptions : undefined; resourceInputs["metadataOptions"] = args ? args.metadataOptions : undefined; resourceInputs["monitoring"] = args ? args.monitoring : undefined; resourceInputs["networkInterfaces"] = args ? args.networkInterfaces : undefined; resourceInputs["placementGroup"] = args ? args.placementGroup : undefined; resourceInputs["placementPartitionNumber"] = args ? args.placementPartitionNumber : undefined; resourceInputs["privateDnsNameOptions"] = args ? args.privateDnsNameOptions : undefined; resourceInputs["privateIp"] = args ? args.privateIp : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["rootBlockDevice"] = args ? args.rootBlockDevice : undefined; resourceInputs["secondaryPrivateIps"] = args ? args.secondaryPrivateIps : undefined; resourceInputs["securityGroups"] = args ? args.securityGroups : undefined; resourceInputs["sourceDestCheck"] = args ? args.sourceDestCheck : undefined; resourceInputs["spotPrice"] = args ? args.spotPrice : undefined; resourceInputs["spotType"] = args ? args.spotType : undefined; resourceInputs["subnetId"] = args ? args.subnetId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tenancy"] = args ? args.tenancy : undefined; resourceInputs["userData"] = args ? args.userData : undefined; resourceInputs["userDataBase64"] = args ? args.userDataBase64 : undefined; resourceInputs["userDataReplaceOnChange"] = args ? args.userDataReplaceOnChange : undefined; resourceInputs["validFrom"] = args ? args.validFrom : undefined; resourceInputs["validUntil"] = args ? args.validUntil : undefined; resourceInputs["volumeTags"] = args ? args.volumeTags : undefined; resourceInputs["vpcSecurityGroupIds"] = args ? args.vpcSecurityGroupIds : undefined; resourceInputs["waitForFulfillment"] = args ? args.waitForFulfillment : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["instanceState"] = undefined /*out*/; resourceInputs["outpostArn"] = undefined /*out*/; resourceInputs["passwordData"] = undefined /*out*/; resourceInputs["primaryNetworkInterfaceId"] = undefined /*out*/; resourceInputs["privateDns"] = undefined /*out*/; resourceInputs["publicDns"] = undefined /*out*/; resourceInputs["publicIp"] = undefined /*out*/; resourceInputs["spotBidStatus"] = undefined /*out*/; resourceInputs["spotInstanceId"] = undefined /*out*/; resourceInputs["spotRequestState"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SpotInstanceRequest.__pulumiType, name, resourceInputs, opts); } } exports.SpotInstanceRequest = SpotInstanceRequest; /** @internal */ SpotInstanceRequest.__pulumiType = 'aws:ec2/spotInstanceRequest:SpotInstanceRequest'; //# sourceMappingURL=spotInstanceRequest.js.map