Getting Started with Amazon RDS Command Line Tools :
The following sections describe how to set up your Amazon RDS environment for use with the Amazon RDS command line tools (also called the API tools or the CLI tools). The command line tools are available as a ZIP file on the Amazon RDS web site. These tools are written in Java, and include shell scripts for Windows 2000/XP/Vista, Linux/UNIX, and Mac OSX. The ZIP file is self-contained and no installation is required; simply download the zip file and unzip it to a directory on your local machine.
Prerequisites:
This blog assumes that the reader is comfortable working in a Linux/UNIX or Windows environment. An installation of a Java 5 compatible Java Runtime Environment (JRE) is required. Additionally, accessing Linux and UNIX instances requires access to an SSH client and accessing Windows instances requires access to a Remote Desktop client. The Amazon RDS command line tools also work correctly on Mac OS X (which resembles the Linux and UNIX command environment), but no specific Mac OS X instructions are included in this guide.
Setting the Java Home Variable
The command line tools used in this guide require Java version 5 or later to run. Either a JRE or JDK installation is acceptable.To view and download JREs for a range of platforms, including Linux/UNIX and Windows, go to http://java.sun.com/j2se/1.5.0/ .
The command line tools depend on an environment variable (JAVA_HOME) to locate the Java Runtime. This environment variable should be set to the full path of the directory that contains the Java Runtime. Inside this directory is a sub directory named bin, which contains the executable java (on Linux and UNIX) or java.exe (on Windows) executable. For example, on Windows this path could be C:\Program Files (x86)\Java\jre6.
To set the Java Home variable :
1. Set the Java Home Variable.
On Linux and UNIX, using the following command:
On Windows, using the following command:
2. Confirm the path setting by running $JAVA_HOME/bin/java -version and checking the output.
On Linux/UNIX, you will see output similar to the following:
On Windows, you will see output similar to the following:
Getting and Configuring Command Line Tools:
1. Where to Get the Command Line Tools
The command line tools are available as a ZIP file on the Amazon RDS web site. These tools are written in Java, and include shell scripts for Windows 2000/XP/Vista, Linux/UNIX, and Mac OSX. The ZIP file is self-contained and no installation is required; simply download the zip file and unzip it to a directory on your local machine.
2. Tell the Tools Where They Live
The command line tools depend on environment variable AWS_RDS_HOME to locate supporting libraries. You need to set this environment variable before you can use the tools. Set it to the path of the directory you unzipped the command line tools into. This directory is named RDSCli-A.B.nnnn (A, B and n are version/release numbers), and contains sub-directories named bin and lib.
Before using the tools, set AWS_RDS_HOME to the directory path where the command line tools were unzipped.
On Linux and UNIX, you can set this environment variable as follows.
On Linux and UNIX, you can set this environment variable as follows.
On Windows the syntax is slightly different.
In addition, to make your life a little easier, you can add the tools' bin directory to your system PATH.The rest of this guide assumes you have done so.
On Linux and UNIX, you can update your PATH as follows.
On Linux and UNIX, you can update your PATH as follows.
On Windows the syntax is slightly different.
NOTE: The Windows environment variables are reset when you close the command window.You might want to set them permanently with the setx command or Consult the documentation for your version of Windows for more information.Paths that contain a space must be wrapped in double quotes, for example: "C:\Program Files\Java"
3. Tell the Tools Who You Are
The command line tools need access to the private key and X.509 certificate for your AWS account.
Since there's nothing stopping you from having more than one AWS account, you need to identify yourself to the command line API tools so they know which credentials to use for requests. It's possible, but tedious,
to provide this information on the command line every time you invoke the tools. It's far simpler to set up some environment variables and be done with it.
There are two environment variables you can set up. They can be set to point at your private key and certificate. After you set these environment variables, the tools use their values to find the relevant credentials. The environment variable AWS_PRIVATE_KEY should reference your private key file, and AWS_CERT should reference your X.509 certificate.
On Linux and UNIX, you can set these environment variables as follows.
Since there's nothing stopping you from having more than one AWS account, you need to identify yourself to the command line API tools so they know which credentials to use for requests. It's possible, but tedious,
to provide this information on the command line every time you invoke the tools. It's far simpler to set up some environment variables and be done with it.
There are two environment variables you can set up. They can be set to point at your private key and certificate. After you set these environment variables, the tools use their values to find the relevant credentials. The environment variable AWS_PRIVATE_KEY should reference your private key file, and AWS_CERT should reference your X.509 certificate.
On Linux and UNIX, you can set these environment variables as follows.
On Windows the syntax is slightly different.