Amazon Elastic Compute Cloud
API Reference (API Version 2011-12-15)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

RequestSpotInstances

Description

Creates a Spot Instance request. Spot Instances are instances that Amazon EC2 starts on your behalf when the maximum price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price based on available Spot Instance capacity and current Spot Instance requests. For more information about Spot Instances, go to Using Spot Instances in the Amazon Elastic Compute Cloud User Guide.

Request Parameters

NameDescriptionRequired

SpotPrice

The maximum hourly price for any Spot Instance launched to fulfill the request.

Type: String

Default: None

Yes

InstanceCount

The maximum number of Spot Instances to launch.

Type: xs:integer

Default: 1

No

Type

The Spot Instance request type.

Type: String

Valid Values: one-time | persistent

Default: one-time

No

ValidFrom

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.

Type: DateTime

Default: Request is effective independently

No

ValidUntil

End date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Type: DateTime

Default: Request is effective indefinitely

No

Subnet

The ID of the Amazon VPC subnet in which to launch the Spot Instance.

Type: String

Default: None

No

LaunchGroup

The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Type: String

Default: Instances are launched and terminated individually

No

AvailabilityZoneGroup

The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.

Type: String

Default: Instances are launched in any available Availability Zone.

No

Placement.GroupName

The name of an existing placement group you want to launch the instance into (for cluster instances).

Type: String

Default: None.

No

LaunchSpecification.ImageId

The AMI ID.

Type: String

Default: None

Yes

LaunchSpecification.KeyName

The name of the key pair.

Type: String

Default: None

No

LaunchSpecification.SecurityGroupId.n

ID of the security group. You can use either this parameter or the next to specify a security group. You can use this parameter when launching instances with or without Amazon VPC.

Type: String

Default: The instance uses the default security group

Condition: If you want to specify one or more security groups, you can use either LaunchSpecification.SecurityGroupId.n or LaunchSpecification.SecurityGroup.n.

Conditional

LaunchSpecification.SecurityGroup.n

Name of the security group. You cannot use this parameter when launching an instance with Amazon VPC.

Type: String

Default: The instance uses the default security group

Condition: If you want to specify one or more security groups, you can use either LaunchSpecification.SecurityGroupId.n or LaunchSpecification.SecurityGroup.n.

Conditional

LaunchSpecification.UserData

MIME, Base64-encoded user data to make available to the instances.

Type: String

Default: None

No

LaunchSpecification.AddressingType

Deprecated.

Type: String

Default: None

No

LaunchSpecification.InstanceType

The instance type.

Type: String

Valid Values: m1.small | m1.large | m1.xlarge | c1.medium | c1.xlarge | m2.xlarge | m2.2xlarge | m2.4xlarge | t1.micro

Default: m1.small

Yes

LaunchSpecification.Placement.AvailabilityZone

The placement constraints (Availability Zone) for launching the instances.

Type: String

Default: Amazon EC2 selects an Availability Zone.

No

LaunchSpecification.KernelId

The ID of the kernel to select.

Type: String

Default: None

No

LaunchSpecification.RamdiskId

The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information on whether you need to specify a RAM disk and search for the kernel ID.

Type: String

Default: None

No

LaunchSpecification.BlockDeviceMapping.n.DeviceName

Describes the mapping that defines native device names to use when exposing virtual devices.

Type: String

Default: None

No

LaunchSpecification.BlockDeviceMapping.n.VirtualName

The virtual device name.

Type: String

Default: None

No

LaunchSpecification.BlockDeviceMapping.n.Ebs.SnapshotId

The ID of the snapshot.

Type: String

Default: None

No

LaunchSpecification.BlockDeviceMapping.n.Ebs.VolumeSize

The size of the volume, in GiBs. Required if you are not creating a volume from a snapshot.

Type: Integer

Default: None

No

LaunchSpecification.BlockDeviceMapping.n.Ebs.NoDevice

Specifies that no device should be mapped.

Type: Boolean

Default: true

No

LaunchSpecification.BlockDeviceMapping.n.Ebs.DeleteOnTermination

Whether the Amazon EBS volume is deleted on instance termination.

Type: Boolean

Default: true

No

LaunchSpecification.Monitoring.Enabled

Enables monitoring for the instance.

Type: String

Default: Disabled

No

Response Elements

The elements in the following table are wrapped in a RequestSpotInstancesResponse structure.

NameDescription

requestId

The ID of the request.

Type: xsd:string

spotInstanceRequestSet

Information about the Spot Instance request, wrapped in an item element.

Type: SpotInstanceRequestSetItemType

Examples

Example Request

This example creates a Spot Instances request for ten m1.small instances.

https://ec2.amazonaws.com/?Action=RequestSpotInstances
&SpotPrice=0.50
&InstanceCount=2
&Type=one-time
&AvailabilityZoneGroup=MyAzGroup
&LaunchSpecification.ImageId=ami-43a4412a
&LaunchSpecification.KeyName=MyKeypair
&LaunchSpecification.Group.1=websrv
&LaunchSpecification.InstanceType=m1.small
&AUTHPARAMS

Example Response

<RequestSpotInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
   <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
   <spotInstanceRequestSet>
      <item>
         <spotInstanceRequestId>sir-83d64e02</spotInstanceRequestId>
         <spotPrice>0.5</spotPrice>
         <type>one-time</type>
         <state>open</state>
         <availabilityZoneGroup>MyAzGroup</availabilityZoneGroup>
         <launchSpecification>
            <imageId>ami-43a4412a</imageId>
            <keyName>MyKeypair</keyName>
            <groupSet>
               <item>
                  <groupId>websrv</groupId>
               </item>
            </groupSet>
            <instanceType>m1.small</instanceType>
            <blockDeviceMapping/>
            <monitoring>
               <enabled>false</enabled>
            </monitoring>
         </launchSpecification>
         <createTime>2010-10-20T18:23:41.000Z</createTime>
         <productDescription>Linux/UNIX</productDescription>
      </item>
      <item>
         ...
      </item>
   </spotInstanceRequestSet>
</RequestSpotInstancesResponse>