The 600 USD command

Posted on April 6, 2009

I recently switched an Amazon instance to the new Amazon reserved instances price scheme. At first I was confused how to do that. Amazon doesn’t provide an interface for buying a preserved. In fact you have to use the EC2 tools and command line to do. I am comfortable to use the command line, however, I never used the command line to buy something.

First, you need to install the EC2 tools. You can find a guide here. After installing the EC2 tools, the following command lists all reserved instances:

ec2-describe-reserved-instances-offerings

This results in the following output:

OFFERING    e5a2ff3b-f6eb-4b4e-83f8-b879d7060257    us-east-1c    c1.medium    3y     1000.0    0.06    Linux/UNIX
OFFERING    248e7b75-afbc-4724-82b2-d78353299433    us-east-1b    c1.medium    3y     1000.0    0.06    Linux/UNIX
OFFERING    60dcfab3-d5b8-4d3d-9f38-480b34d38239    us-east-1a    c1.medium    3y     1000.0    0.06    Linux/UNIX
OFFERING    c48ab04c-42bb-4e5b-8c1b-c015f9604dd5    us-east-1c    c1.medium    1y     650.0    0.06    Linux/UNIX
OFFERING    ceb6a579-b754-4a50-a53e-36efdb8eb28b    us-east-1b    c1.medium    1y     650.0    0.06    Linux/UNIX
OFFERING    3a98bf7d-b94b-412a-8de5-8c77dfcc4ffd    us-east-1a    c1.medium    1y     650.0    0.06    Linux/UNIX
OFFERING    248e7b75-ed4c-4ca7-b42b-d14ee74a3360    us-east-1b    c1.xlarge    3y     4000.0    0.24    Linux/UNIX
OFFERING    ceb6a579-1420-4728-ace3-9cb73934afcf    us-east-1c    c1.xlarge    3y     4000.0    0.24    Linux/UNIX
OFFERING    60dcfab3-97dd-421b-8f75-c126de7741ce    us-east-1a    c1.xlarge    3y     4000.0    0.24    Linux/UNIX
OFFERING    ceb6a579-f9b0-4bff-994c-c62030080d27    us-east-1b    c1.xlarge    1y     2600.0    0.24    Linux/UNIX
OFFERING    4b2293b4-cb88-480b-999d-a17683faa92f    us-east-1c    c1.xlarge    1y     2600.0    0.24    Linux/UNIX
OFFERING    60dcfab3-fa53-4d32-97cc-2fd1a0a8c0ac    us-east-1a    c1.xlarge    1y     2600.0    0.24    Linux/UNIX
OFFERING    649fd0c8-8bd3-489e-904c-4c5dfcb131ea    us-east-1b    m1.large    3y     2000.0    0.12    Linux/UNIX
OFFERING    248e7b75-5324-48e5-9749-fd3b4de01829    us-east-1a    m1.large    3y     2000.0    0.12    Linux/UNIX
OFFERING    d586503b-6876-4d40-8f94-1b2dde6b0ead    us-east-1c    m1.large    3y     2000.0    0.12    Linux/UNIX
OFFERING    248e7b75-a817-462e-996a-8ea7b4810a0e    us-east-1b    m1.large    1y     1300.0    0.12    Linux/UNIX
OFFERING    c48ab04c-280c-4879-8119-63ac87002498    us-east-1a    m1.large    1y     1300.0    0.12    Linux/UNIX
OFFERING    649fd0c8-4af1-4f63-bbdb-1a05951886a4    us-east-1c    m1.large    1y     1300.0    0.12    Linux/UNIX
OFFERING    3a98bf7d-96c3-4d2f-a263-123fa6b46d61    us-east-1b    m1.small    3y     500.0    0.03    Linux/UNIX
OFFERING    248e7b75-0799-4a55-a0cb-f8d28eb11921    us-east-1a    m1.small    3y     500.0    0.03    Linux/UNIX
OFFERING    438012d3-d93c-4fbd-a245-33b4bf0930ec    us-east-1c    m1.small    3y     500.0    0.03    Linux/UNIX
OFFERING    60dcfab3-a56c-4092-8c90-3677e9da02b7    us-east-1b    m1.small    1y     325.0    0.03    Linux/UNIX
OFFERING    4b2293b4-1e6c-4eb3-ab74-4493c0e57987    us-east-1a    m1.small    1y     325.0    0.03    Linux/UNIX
OFFERING    c48ab04c-c057-457e-a4d8-a0f172f4db2d    us-east-1c    m1.small    1y     325.0    0.03    Linux/UNIX
OFFERING    c48ab04c-6769-4bc1-966e-f7b0326001dd    us-east-1b    m1.xlarge    3y     4000.0    0.24    Linux/UNIX
OFFERING    649fd0c8-4767-43a1-a530-b4a1f0c08c31    us-east-1a    m1.xlarge    3y     4000.0    0.24    Linux/UNIX
OFFERING    d586503b-20ad-4beb-bc88-60a1333c2b98    us-east-1c    m1.xlarge    3y     4000.0    0.24    Linux/UNIX
OFFERING    e5a2ff3b-8646-4f48-912a-aaeba5823c73    us-east-1b    m1.xlarge    1y     2600.0    0.24    Linux/UNIX
OFFERING    c48ab04c-63ab-4cd6-b8f5-978a29eb9bcc    us-east-1a    m1.xlarge    1y     2600.0    0.24    Linux/UNIX
OFFERING    c48ab04c-119e-41f1-8b0f-b83c4fc4f869    us-east-1c    m1.xlarge    1y     2600.0    0.24    Linux/UNIX

So, to reserve one small instance in the us-east-1a region, just type

ec2-purchase-reserved-instances-offering -c 1 -o 248e7b75-0799-4a55-a0cb-f8d28eb11921

then press enter and you are credited 500 USD plus 100 USD taxes. However, in 300 days the command pays for itself.

Related posts:

  1. Amazon EC2 preserved instances pricing scheme
  2. Amazon EC2 Rails roundup: 2 small instances vs 1 high CPU medium instance

Tags: , ,

Leave a Reply

Subscribe