AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the RequestSpotInstances operation. Creates a Spot Instance request.
For more information, see Work with Spot Instance in the Amazon EC2 User Guide.
We strongly discourage using the RequestSpotInstances API because it is a legacy API with no planned investment. For options for requesting Spot Instances, see Which is the best Spot request method to use? in the Amazon EC2 User Guide.
Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z
public class RequestSpotInstancesRequest : AmazonEC2Request IAmazonWebServiceRequest
The RequestSpotInstancesRequest type exposes the following members
Name | Description | |
---|---|---|
RequestSpotInstancesRequest() |
Empty constructor used to set properties independently even when a simple constructor is available |
|
RequestSpotInstancesRequest(string) |
Instantiates RequestSpotInstancesRequest with the parameterized properties |
Name | Type | Description | |
---|---|---|---|
AvailabilityZoneGroup | System.String |
Gets and sets the property AvailabilityZoneGroup. The user-specified name for a logical grouping of requests. When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to requests for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active. If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the request is expired, or the maximum price you specified falls below current Spot price), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group. Default: Instances are launched in any available Availability Zone. |
|
BlockDurationMinutes | System.Int32 |
Gets and sets the property BlockDurationMinutes. Deprecated. |
|
ClientToken | System.String |
Gets and sets the property ClientToken. Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency in Amazon EC2 API requests in the Amazon EC2 User Guide. |
|
InstanceCount | System.Int32 |
Gets and sets the property InstanceCount. The maximum number of Spot Instances to launch. Default: 1 |
|
InstanceInterruptionBehavior | Amazon.EC2.InstanceInterruptionBehavior |
Gets and sets the property InstanceInterruptionBehavior.
The behavior when a Spot Instance is interrupted. The default is |
|
LaunchGroup | System.String |
Gets and sets the property LaunchGroup. The instance launch group. Launch groups are Spot Instances that launch together and terminate together. Default: Instances are launched and terminated individually |
|
LaunchSpecification | Amazon.EC2.Model.LaunchSpecification |
Gets and sets the property LaunchSpecification. The launch specification. |
|
SpotPrice | System.String |
Gets and sets the property SpotPrice. The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price. If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter. |
|
TagSpecifications | System.Collections.Generic.List<Amazon.EC2.Model.TagSpecification> |
Gets and sets the property TagSpecifications.
The key-value pair for tagging the Spot Instance request on creation. The value for
|
|
Type | Amazon.EC2.SpotInstanceType |
Gets and sets the property Type. The Spot Instance request type.
Default: |
|
ValidFrom | System.DateTime |
Gets and sets the property ValidFromUtc. This property is deprecated. Setting this property results in non-UTC DateTimes not being marshalled correctly. Use ValidFromUtc instead. Setting either ValidFrom or ValidFromUtc results in both ValidFrom and ValidFromUtc being assigned, the latest assignment to either one of the two property is reflected in the value of both. ValidFrom is provided for backwards compatibility only and assigning a non-Utc DateTime to it results in the wrong timestamp being passed to the service. The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled. The specified start date and time cannot be equal to the current date and time. You must specify a start date and time that occurs after the current date and time. |
|
ValidFromUtc | System.DateTime |
Gets and sets the property ValidFromUtc. The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled. The specified start date and time cannot be equal to the current date and time. You must specify a start date and time that occurs after the current date and time. |
|
ValidUntil | System.DateTime |
Gets and sets the property ValidUntilUtc. This property is deprecated. Setting this property results in non-UTC DateTimes not being marshalled correctly. Use ValidUntilUtc instead. Setting either ValidUntil or ValidUntilUtc results in both ValidUntil and ValidUntilUtc being assigned, the latest assignment to either one of the two property is reflected in the value of both. ValidUntil is provided for backwards compatibility only and assigning a non-Utc DateTime to it results in the wrong timestamp being passed to the service. The end date of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ).
|
|
ValidUntilUtc | System.DateTime |
Gets and sets the property ValidUntilUtc. The end date of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ).
|
This example creates a one-time Spot Instance request for five instances in the specified Availability Zone. If your account supports EC2-VPC only, Amazon EC2 launches the instances in the default subnet of the specified Availability Zone.
var client = new AmazonEC2Client(); var response = client.RequestSpotInstances(new RequestSpotInstancesRequest { InstanceCount = 5, LaunchSpecification = new RequestSpotLaunchSpecification { IamInstanceProfile = new IamInstanceProfileSpecification { Arn = "arn:aws:iam::123456789012:instance-profile/my-iam-role" }, ImageId = "ami-1a2b3c4d", InstanceType = "m3.medium", KeyName = "my-key-pair", Placement = new SpotPlacement { AvailabilityZone = "us-west-2a" }, }, SpotPrice = "0.03", Type = "one-time" });
This example command creates a one-time Spot Instance request for five instances in the specified subnet. Amazon EC2 launches the instances in the specified subnet. If the VPC is a nondefault VPC, the instances do not receive a public IP address by default.
var client = new AmazonEC2Client(); var response = client.RequestSpotInstances(new RequestSpotInstancesRequest { InstanceCount = 5, LaunchSpecification = new RequestSpotLaunchSpecification { IamInstanceProfile = new IamInstanceProfileSpecification { Arn = "arn:aws:iam::123456789012:instance-profile/my-iam-role" }, ImageId = "ami-1a2b3c4d", InstanceType = "m3.medium", SubnetId = "subnet-1a2b3c4d" }, SpotPrice = "0.050", Type = "one-time" });
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5