Amazon Elastic Compute Cloud
CLI Reference (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

ec2-purchase-reserved-instances-offering

Description

Purchases a Reserved Instance for use with your account. With Amazon EC2 Reserved Instances, you obtain a capacity reservation for a certain instance configuration over a specified period of time. You pay a lower usage rate than with On-Demand instances for the time that you actually use the capacity reservation.

Starting with the 2011-11-01 API version, AWS expanded its offering of Amazon EC2 Reserved Instances to address a range of projected instance usage. There are three types of Reserved Instances based on customer utilization levels: Heavy Utilization, Medium Utilization, and Light Utilization.

The Medium Utilization offering type is equivalent to the Reserved Instance offering available before API version 2011-11-01. If you are using tools that predate the 2011-11-01 API version, ec2-describe-reserved-instances-offerings will only list information about the Medium Utilization Reserved Instance offering type.

For information about Reserved Instance pricing tiers, go to Understanding Reserved Instance pricing tiers in the Amazon Elastic Compute Cloud User Guide. For more information about Reserved Instances, go to Reserved Instances also in the Amazon Elastic Compute Cloud User Guide.

You determine the type of the Reserved Instances offerings by including the optional offeringType parameter when calling ec2-describe-reserved-instances-offerings. After you've identified the Reserved Instance with the offering type you want, specify its ReservedInstancesOfferingId when you call ec2-purchase-reserved-instances-offering.

Starting with the 2012-08-15 API version, you can also purchase Reserved Instances from the Reserved Instance Marketplace. The Reserved Instance Marketplace matches sellers who want to resell Reserved Instance capacity that they no longer need with buyers who want to purchase additional capacity. Reserved Instances bought from third parties through the Reserved Instance Marketplace work like any other Reserved Instances.

By default, with the 2012-08-15 API version, ec2-describe-reserved-instances-offerings returns information about Amazon EC2 Reserved Instances available directly from AWS, plus instance offerings available from third parties, on the Reserved Instance Marketplace. If you are using tools that predate the 2012-08-15 API version, the ec2-describe-reserved-instances-offerings action will only list information about Amazon EC2 Reserved Instances available directly from AWS.

For more information about the Reserved Instance Marketplace, go to Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide.

You determine the Reserved Instance Marketplace offerings by specifying true for the optional includeMarketplace parameter when calling ec2-describe-reserved-instances-offerings. After you've identified the Reserved Instance with the offering type you want, specify its reservedInstancesOfferingId when you call ec2-purchase-reserved-instances-offering.

The short version of this command is ec2prio.

Syntax

ec2-purchase-reserved-instances-offering --offering offering --instance-count count [-l limit-price]

Options

NameDescription

-o, --offering offering

The offering ID of the Reserved Instance to purchase.

Type: String

Default: None

Required: Yes

Example: -o 4b2293b4-5813-4cc8-9ce3-1957fexample

-c, --instance-count count

The number of Reserved Instances to purchase.

Type: Integer

Default: None

Required: Yes

Example: -c 5

-l limit-price

The maximum price that you are willing to pay.

Type: Integer

Default: None

Required: Yes

Example: -c 5

Common Options

OptionDescription

--region REGION

Overrides the region specified by the EC2_URL environment variable and the URL specified by the -U option.

Default: The value of the EC2_URL environment variable, or us-east-1 if EC2_URL isn't set.

Example: --region eu-west-1

-U, --url URL

The uniform resource locator (URL) of the Amazon EC2 web service entry point.

Default: The value of the EC2_URL environment variable, or https://ec2.amazonaws.com if EC2_URL isn't set.

Example: -U https://ec2.amazonaws.com

-K, --private-key EC2-PRIVATE-KEY

The private key that identifies you to Amazon EC2. For more information, see Tell the Tools Who You Are.

Default: The value of the EC2_PRIVATE_KEY environment variable. If EC2_PRIVATE_KEY isn't set, you must specify this option.

Example: -K pk-HKZYKTAIG2ECMXYIBH3HXV4ZBEXAMPLE.pem

-C, --cert EC2-CERT

The X.509 certificate that identifies you to Amazon EC2.

Default: The value of the EC2_CERT environment variable. If EC2_CERT isn't set, you must specify this option.

Example: -C cert-HKZYKTAIG2ECMXYIBH3HXV4ZBEXAMPLE.pem

-O, --aws-access-key AWS_ACCESS_KEY

The access key ID associated with your AWS account. For more information, see Tell the Tools Who You Are.

Default: The value of the AWS_ACCESS_KEY environment variable. If AWS_ACCESS_KEY isn't set, you must specify this option.

Example: -O AKIAIOSFODNN7EXAMPLE

Note

For more information, see the following section, Deprecated Options.

-W, --aws-secret-key AWS_SECRET_KEY

The secret access key associated with your AWS account.

Default: The value of the AWS_SECRET_KEY environment variable. If AWS_SECRET_KEY isn't set, you must specify this option.

Example: -W wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Note

For more information, see the following section, Deprecated Options.

-T, --security-token TOKEN AWS_DELEGATION_TOKEN

The AWS delegation token.

Default: The value of the environment variable (if set).

--connection-timeout TIMEOUT

The connection timeout, in seconds.

Example: --connection-timeout 30

--request-timeout TIMEOUT

The request timeout, in seconds.

Example: --request-timeout 45

-v, --verbose

Displays verbose output, including the API request and response on the command line. This is useful if you are building tools to talk directly to our Query API.

-H, --headers

Includes column headers in the command output.

--show-empty-fields

Shows empty columns as (nil).

--hide-tags

Omits tags for tagged resources.

--debug

Displays internal debugging information. This can assist us when helping you troubleshooting problems.

-?, --help, -h

Displays usage information for the command.

-

Reads arguments from standard input. This is useful when piping the output from one command to the input of another.

Example: ec2-describe-instances | grep stopped | cut -f 2 | ec2-start-instances -

Deprecated Options

For a limited time, you can still use the private key and X.509 certificate instead of your access key ID and secret access key. However, we recommend that you start using your access key ID (-O, --aws-access-key) and secret access key (-W, --aws-secret-key) now, as the private key (-K, --private-key) and X.509 certificate (-C, --cert) won't be supported after the transition period elapses. For more information, see Tell the Tools Who You Are.

OptionDescription

-K, --private-key EC2-PRIVATE-KEY

The private key to use when constructing requests to Amazon EC2.

Default: The value of the EC2_PRIVATE_KEY environment variable.

Example: -K pk-HKZYKTAIG2ECMXYIBH3HXV4ZBEXAMPLE.pem

-C, --cert EC2-CERT

The X.509 certificate to use when constructing requests to Amazon EC2.

Default: The value of the EC2_CERT environment variable.

Example: -C cert-HKZYKTAIG2ECMXYIBH3HXV4ZBEXAMPLE.pem

Output

The command returns a table that contains the following information:

  • RESERVEDINSTANCES identifier

  • The ID of the purchased Reserved Instances

Amazon EC2 command line tools display errors on stderr.

Examples

This example illustrates a purchase of a Reserved Instances offering.

PROMPT> ec2-purchase-reserved-instances-offering --offering 649fd0c8-becc-49d9-b259-fc8e2example --instance-count 3
RESERVEDINSTANCES	b847fa93-0c31-405b-b745-b6bf0example