Reserve RDS Instance Using AWS CLI
If you have recently reserved a AWS EC2 instances you will know that it can be done easily in the AWS Management Console by selection the "Purchase Reserved Instances" option.
Then you read that you can now reserve a Amazon Relational Database Service (RDS) instance so you look for the button on the Console and find that Amazon haven't added this feature yet. So what do you do? Here is a step by step guide for novice user of the Command Line Interface (CLI) on how to reserve an instance.
Download public/private keys:
1. Login to http://aws.amazon.com
2. Point to "Your Account" and click "Security Credentials"
3. In the Access Credentials section of the page, click the X.509 Certificates tab.
4. Click Create a New Certificate.
Your X.509 certificate and corresponding private key are generated.
5. From the dialog box, download your private key file and X.509 certificate file.
Setup the RDS CLI:
1. Download the RDS Command Line Interface (CLI) RDSCli.zip
2. Unzip to C:\RDSCli
3. C:\set AWS_RDS_HOME=C:\RDSCli\RDSCli-1.3.003
4. C:\set EC2_CERT=c:\keys\cert-********************************************.pem
5. C:\set EC2_PRIVATE_KEY=c:\keys\pk-********************************************.pem
Reserve Instance:
1. First use the rds-describe-reserved-db-instances command to returns the list of DB Instance reservations for your account or details for one of your reserved database instances.
C:\rds-describe-reserved-db-instances --region eu-west-1
If you have no existing reserved RDS instances for the specified region then this will return nothing.
2. Next use rds-describe-reserved-db-instances-offerings to returns the list of DB Instance offerings that are available for purchase.
C:\rds-describe-reserved-db-instances-offerings --region eu-west-1
OFFERING 248e7b75-3883-4c10-b628-5ce44f4b53ea db.m1.xlarge n 1y $1820.00 $0.471 mysql
OFFERING 3a98bf7d-fed8-4912-8e40-f0bb5491d217 db.m1.large y 1y $1820.00 $0.471 mysql
OFFERING 4b2293b4-65c7-46c2-a92e-a6c03000a28b db.m2.4xlarge y 3y $16000.00 $2.816 mysql
OFFERING 4b2293b4-679e-4c98-b2e6-35ab9d841f72 db.m2.xlarge n 1y $1325.00 $0.352 mysql
OFFERING 60dcfab3-4eeb-4f93-8cfe-998181354391 db.m2.2xlarge y 3y $8000.00 $1.408 mysql
OFFERING 60dcfab3-eaf2-4d60-a422-f05ced59f8d1 db.m2.4xlarge y 1y $10600.00 $2.816 mysql
OFFERING 649fd0c8-3b34-4876-b3ec-31bf4067bffb db.m1.xlarge n 3y $2800.00 $0.471 mysql
OFFERING 649fd0c8-5c8a-4eb7-b34d-50ebf9cf99cc db.m1.large n 3y $1400.00 $0.235 mysql
OFFERING 649fd0c8-6b22-4d6a-ba19-9c44a434749c db.m1.small y 3y $700.00 $0.118 mysql
OFFERING 649fd0c8-8e0e-4b61-be86-56b61cfed4df db.m2.4xlarge n 3y $8000.00 $1.408 mysql
OFFERING 649fd0c8-c5dc-4ac9-b3f6-4da80d2fbc35 db.m1.large y 3y $2800.00 $0.471 mysql
OFFERING 649fd0c8-f8f2-4403-a78c-4d40891d72b1 db.m1.small n 3y $350.00 $0.059 mysql
OFFERING c48ab04c-3dc4-45e4-8fb5-ed524e0d427b db.m2.xlarge y 3y $4000.00 $0.704 mysql
OFFERING ceb6a579-3643-46fc-bb5c-dfeda95895b0 db.m2.xlarge y 1y $2650.00 $0.704 mysql
OFFERING ceb6a579-4495-45fb-b4ad-752e93c31a27 db.m2.4xlarge n 1y $5300.00 $1.408 mysql
OFFERING ceb6a579-a4f3-4b55-ac53-7208e3c4b0fd db.m1.small n 1y $227.50 $0.059 mysql
OFFERING ceb6a579-afd6-4446-bd79-f6c3a6af17fc db.m2.2xlarge n 1y $2650.00 $0.704 mysql
OFFERING ceb6a579-c113-4a40-be7c-59c4ac3681fa db.m2.xlarge n 3y $2000.00 $0.352 mysql
OFFERING d586503b-4abb-49fa-837a-415b8e7360e9 db.m1.xlarge y 3y $5600.00 $0.942 mysql
OFFERING d586503b-6fb4-4c87-a1cf-df1535f75d54 db.m1.large n 1y $910.00 $0.235 mysql
OFFERING d586503b-9a28-4512-91b4-173d0a808e69 db.m2.2xlarge n 3y $4000.00 $0.704 mysql
OFFERING e5a2ff3b-511c-4f8e-9737-8899eff42b8d db.m1.small y 1y $455.00 $0.118 mysql
OFFERING e5a2ff3b-62dc-457a-8320-906818958672 db.m2.2xlarge y 1y $5300.00 $1.408 mysql
OFFERING e5a2ff3b-eb93-4c31-83b1-4db9c473c736 db.m1.xlarge y 1y $3640.00 $0.942 mysql
3. Looking at the list of instance types and prices select the ID of the one you require, in my case the db.m1.small for 1 year and use the rds-purchase-reserved-db-instances-offering command to purchase it.
C:\RDSCli\RDSCli-1.3.003\bin>rds-purchase-reserved-db-instances-offering ceb6a579-a4f3-4b55-ac53-7208e3c4b0fd --region eu-west-1 -c 1
RESERVATION ri-2010-11-17-13-17-40-410 db.m1.small n 2010-11-17T13:17:40.410Z 1y 1 payment-pending mysql
4. Check a while later to see the status, it should now be active.
C:\RDSCli\RDSCli-1.3.003\bin>rds-describe-reserved-db-instances --region eu-west-1
RESERVATION ri-2010-11-17-13-17-40-410 db.m1.small n 2010-11-17T13:19:19.272Z 1y 1 active mysql
All done, you have now purchased your RDS reserved instance.