Amazon CloudWatch
Getting Started Guide (API Version 2010-08-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Set Up the Command Line Interface

Set Up The CloudWatch Command Line Interface

Install the Command Line Tools

To use the commands described in this guide, you must install and configure the command line tools.

To install the Amazon CloudWatch command line tools

  1. Download the command line tools from Amazon CloudWatch Tools.

  2. Save and unpack the Amazon CloudWatch archive to a convenient location on your workstation.

  3. Enter the command java -version to determine the version of Java installed on your workstation. If you do not have version 1.5 or newer, download and install a newer version from http://www.java.com.

  4. Set the JAVA_HOME environment variable to point to your Java installation.

    The following is an example of how to set this environment variable in Linux and UNIX.

    $ export JAVA_HOME=<PATH>

    The following is an example of the syntax in Windows.

    C:\> set JAVA_HOME=<PATH>
  5. Make the following addition to your PATH environment variable.

    On Linux and UNIX, you can update your PATH as follows:

    $ export PATH=$PATH:$JAVA_HOME/bin 

    Note

    The export command applies only to the current shell session. To permanently create or update an environment variable, include the command in a start-up script. For example, if you use Bash shell, you can include commands in your ~/.bashrc or /etc/profile file.

    On Windows the syntax is slightly different:

    C:\> set PATH=%PATH%;%JAVA_HOME%\bin 

    Note

    The Windows environment variables are reset when you close the command window. You might want to set them permanently with the setx command.

  6. Set the AWS_CLOUDWATCH_HOME environment variable to the location where you unpacked the CloudWatch archive.

    On Linux and UNIX, you can set this environment variable as follows:

    $ export AWS_CLOUDWATCH_HOME=<path-to-tools>  

    On Windows the syntax is slightly different:

    C:\> set AWS_CLOUDWATCH_HOME=<path-to-tools>  
  7. Make the following addition to your PATH environment variable.

    On Linux and UNIX, you can update your PATH as follows:

    $ export PATH=$PATH:$AWS_CLOUDWATCH_HOME/bin 

    On Windows the syntax is slightly different:

    C:\> set PATH=%PATH%;%AWS_CLOUDWATCH_HOME%\bin 

Configure the Tools for Your Credentials

Before you use Amazon CloudWatch, you must provide your AWS credentials to the command line tools. You can use your AWS access keys.

To use access keys with the command line tools

  1. Navigate to the AWS security credentials page.

    You will be prompted to log in if you haven't already.

  2. Scroll down to Access Credentials to get your Access Key ID and your Secret Access Key.

    Access Credentials
  3. Add your access key id and secret access key to the file named credential-file-path.template.

    • On Linux and UNIX, you can find the file here: $AWS_CLOUDWATCH_HOME/credential-file-path.template

    • On Windows, you can find the file here: %AWS_CLOUDWATCH_HOME%\credential-file-path.template

  4. Rename the file and save it to a convenient location on your workstation.

    • If you are using Linux or UNIX, set the file permissions as follows:

      $ chmod 600 <credential file name>
    • On Windows, you do not need to change the file permissions.

  5. Set the AWS_CREDENTIAL_FILE environment variable to the fully-qualified path of the credential file you just created.

    On Linux and UNIX, you can set this environment variable as follows:

    $ export AWS_CREDENTIAL_FILE=<path-to-file>  

    On Windows the syntax is slightly different:

    C:\> set AWS_CREDENTIAL_FILE=<path-to-file>  

Test Your Configuration

To test your installation and configuration of Amazon CloudWatch

  1. On your workstation, open a new command prompt.

  2. Type the command mon-cmd.

  3. You should see output similar to the following:

    Command Name                       Description                                            
    ------------                       -----------               
    mon-delete-alarms                  Delete alarms      
    mon-describe-alarm-history         Describe alarm history  
    mon-describe-alarms                Describe alarms fully. 
    mon-describe-alarms-for-metric     Describe all alarms ... a single metric
    mon-disable-alarm-actions          Disable all actions for a given alarm
    mon-enable-alarm-actions           Enable all actions for a given alarm
    mon-get-stats                      Get metric statistics        
    mon-list-metrics                   List user's metrics      
    mon-put-data                       Put metric data 
    mon-put-metric-alarm               Create new alarm or update existing one
    mon-set-alarm-state                Manually set the state of an alarm
    mon-version                        Prints the version ... tool and the API 
    
    For help on a specific command, type '<commandname> --help'

This completes your installation and configuration of the CloudWatch command line tools.

Publish Metrics