ec2-request-spot-instances

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 conceptual information about Spot Instances, refer to the Amazon Elastic Compute Cloud Developer Guide or Amazon Elastic Compute Cloud User Guide.

Syntax

ec2-request-spot-instances --price price [--instance-count count] [--type type] [--valid-from timestamp] [--valid-until timestamp] [--launch-group group] [--availability-zone-group group] group] [--user-data data] [--user-data-file data-file] [--group group] [--key key-pair] [--monitor] [--instance-type type] [--availability-zone zone] [--kernel kernel] [--ramdisk ramdisk] [--block-device-mapping mapping]

Options

NameDescriptionRequired

--price price

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

Type: String

Default: None

Example: --price .15

Yes

--count count

The maximum number of Spot Instances to launch.

Type: xs:integer

Default: 1

Example: --count 10

No

--type type

Specifies the Spot Instance type.

Type: String

Valid Values: one-time | persistent

Default: one-time

Example: --type persistent

No

--valid-from date

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

Example: --valid-from 2009-12-01T11:51:50.000Z

No

--valid-until date

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

Example: --valid-until 2009-12-31T11:51:50.000Z

No

--launch-group group

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

Type: String

Default: Instances are launched and terminated individually

Example: --launch-group Skynet

No

--availability-zone-group group

Specifies 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.

Example: --availability-zone-group batchGroup01

No

ami_id

The AMI ID.

Type: String

Default: None

Example: ami-2bb65342

Yes

-k keyname

The name of the key pair.

Type: String

Default: None

Example: MyKeyPair

No

group

Name of the security group.

Type: String

Default: None

Example: websrv

No

-d user_data

MIME, Base64-encoded user data.

Type: String

Default: None

Example: my user data

No

--type instance_type

Specifies the instance type.

Type: String

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

Default: m1.small

Example: m1.large

No

--kernel

The ID of the kernel to select.

Type: String

Default: None

Example: aki-ba3adfd3

No

--ramdisk

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

Example: ari-badbad00

No

--subnet

Specifies the Amazon VPC subnet ID within which to launch the instance(s) for Amazon Virtual Private Cloud.

Type: String

Default: None

Example: --subnet MyPrivateSubnet

No

--availability-zone zone

Specifies the placement constraints (Availability Zones) for launching the instances.

Type: String

Default: Amazon EC2 selects an Availability Zone.

Example: us-east-1b

No

-b, --block-device-mapping

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

Type: String

Default: None

Example: -b

No

--monitored

Enables monitoring for the instance.

Type: String

Default: Disabled

Example: --monitored

No

Output

The command returns a table that contains the following information:

  • Instance ID

  • Price

  • Type

  • Valid Until

  • Hold Until

  • Launch Group

  • Availability Zone Group

  • Create Time

  • Description

  • State

  • Fault

Amazon EC2 displays errors on stderr.

Examples

Example Request

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

PROMPT> ec2-request-spot-instances --price 0.50 --image-id i-43a4412a --keyname MyKeypair --group websrv
							--instance-type m1.small --instance-count 10 --request-type one-time 
SPOTINSTANCEREQUEST sir-f102a405 0.1 one-time Linux/UNIX active
							2009-12-12T22:58:47+0200 i-3597b470 ami-7d3b6a38 m1.small default
							monitoring-enabled