Command Line Tools Reference
The Amazon EC2 command line tools provide a command line interface to the web service API. This section describes each tool and its command line arguments in detail.
Command line options and arguments are based on the GNU getopt conventions. Optional parameters are indicated by means of flags. Flags typically come in a short and long form, although not all flags exist in both forms. In their short form, flags are a single character prefixed with a single dash. In their long form, flags use a longer, more expressive name prefixed with a double dash. Optional parameters typically have default values, or may be required only when other optional parameters are specified, and order is unimportant. For all remaining parameters order does matter.
A number of command line options apply to all of the command line tools. These are covered below and, for reasons of brevity, are not included in the description of each of the specific tools.
Any service errors encountered by the command line tools will be passed straight through from the API. A list of these errors can be seen in the section called “API Error Codes”.
Most command line tools covered in the following sections accept a common set of optional parameters as follows:
Element Name | Definition | Valid Values/Types | Example |
---|---|---|---|
-U URL
|
URL is the uniform resource locator of the Amazon EC2 web
service entry point. This option defaults to the value
of the EC2_URL environment variable, or
http://ec2.amazonaws.com if that is not set.
|
URL |
-U http://ec2.amazonaws.com
|
-K EC2-PRIVATE-KEY
|
The private key to use when constructing
requests to Amazon EC2. This parameter defaults
to the value of the EC2_PRIVATE_KEY
environment variable.
|
File name |
-K pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
|
-C EC2-CERT
|
The X509 certificate to use when
constructing requests to Amazon EC2. This
parameter defaults to the value of the
EC2_CERT environment variable.
|
File name |
-C cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
|
-v
|
Increase output verbosity. This will print the SOAP request and response on the command line. This is particularly useful if you're trying to build your own tools to talk directly to our SOAP API. |
N/A | N/A |
--show-empty-fields
|
Shows empty columns as |
N/A | N/A |
--debug
|
Print internal debugging information. This is intended to assist us to troubleshoot problems. |
N/A | N/A |
-?
|
Show help. |
N/A | N/A |
-
|
If - is specified as an argument
to one of the parameters, a list of arguments will be
read from stdin. This is useful for piping the output
of one command into the input of another.
|
N/A |
ec2-describe-instances | grep running | cut -f 2 | ec2-terminate-instances -i -
|