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. Parameters are invoked using flags, which typically come in short and long form. In their short form, flags use a single character preceded by a dash. In their long form, flags use a more expressive name preceded by two dashes.

[Note]Note

Some common options apply to all command line tools. These are described below and are not included in the description of the specific tools.

Any service errors encountered by the command line tools are passed straight through from the API. For more information about these errors, see API Error Codes.

Most command line tools described in this section accept the the following set of optional parameters:

OptionDescription

-U URL

URL is the uniform resource locator of the Amazon EC2 web service entry point.

Default: The EC2_URL environment variable, or http://ec2.amazonaws.com if the environment variable is not set.

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

-K 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-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem

-C 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-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem

-v

Displays verbose output by showing the SOAP request and response on the command line. This is particularly useful if you are building tools to talk directly to our SOAP API.

--show-empty-fields

Shows empty columns as (nil).

--debug

Prints internal debugging information. This is useful to assist us when troubleshooting problems.

-?

Displays help.

-

If - is specified as an argument to one of the parameters, a list of arguments are read from standard input. This is useful for piping the output of one command into the input of another.

Example: ec2-describe-instances | grep running | cut -f 2 | ec2-terminate-instances -i -