| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |

This section describes how to set up the Auto Scaling command line interface.
Note
As a convention, command line text is prefixed with a generic
command line prompt. The actual command line
prompt on your computer is likely to be different. We also use
PROMPT> $ to indicate a Linux/UNIX–specific
command and for a Windows–specific
command. Although we don't provide explicit instructions, the tool also works on the
Mac OS X. (Commands on the Mac OS X resemble the Linux and UNIX commands.) The
example output resulting from the command is shown immediately thereafter without
any prefix. C:\>
The command line tool is available as a ZIP file on Auto Scaling Command Line Tools. The tool is written in Java and includes shell scripts for both Windows and Linux/UNIX/Mac OSX. The ZIP file is self-contained; no installation is required. You just download it and unzip it.
Some additional setup is required before you can use the tool. These steps are discussed next.
The Auto Scaling command line tool reads an environment variable
(JAVA_HOME) on your computer to locate the Java runtime.
The command line tool requires Java version
5 or later to run. Either a JRE or JDK installation is
acceptable.
To set the JAVA_HOME Environment Variable
If you do not have Java 1.5 or later installed, download and install it now. To view and download JREs for a range of platforms, including Linux/UNIX and Windows, go to http://java.oracle.com/.
Set JAVA_HOME to the full path of the
directory that contains a subdirectory
named bin that in turn contains
the Java executable. For example, if your Java executable
is in the /usr/jdk/bin directory, set
JAVA_HOME to /usr/jdk. If your Java
executable is in C:\jdk\bin, set
JAVA_HOME to C:\jdk.
Note
If you are using Cygwin tool to provide a Linux look and feel environment for
Windows, you must use Linux/UNIX paths (e.g., /usr/bin instead of
C:\usr\bin) for AWS_AUTO_SCALING_HOME and AWS_CREDENTIAL_FILE. However,
JAVA_HOME should have a Windows path. Additionally,
the value cannot contain any spaces, even if the value is quoted or the
spaces are escaped.
The following Linux/UNIX example sets JAVA_HOME for a Java executable
in the /usr/local/jre/bin directory.
$export JAVA_HOME=/usr/local/jre
The following Windows example uses set and setx to set JAVA_HOME for a Java executable
in the C:\java\jdk1.6.0_6\bin directory. The set command defines JAVA_HOME for the current session and setx makes the change permanent.
C:\>set JAVA_HOME=C:\java\jdk1.6.0_6C:\>setx JAVA_HOMEC:\java\jdk1.6.0_6
Note
Don't include the bin directory in JAVA_HOME; that's a common mistake some users make. The command line tool won't work if you do.
Add your Java directory to your path before other versions of Java.
On Linux and UNIX, you can update your PATH as follows:
$export PATH=$JAVA_HOME/bin:$PATH
On Windows the syntax is slightly different:
C:\>set PATH=%JAVA_HOME%\bin;%PATH%C:\>setx PATH %JAVA_HOME%\bin;%PATH%
Note
The setx command does not use the = sign.
On Linux or UNIX, verify your JAVA_HOME setting with the command
$JAVA_HOME/bin/java -version.
$$JAVA_HOME/bin/java -versionjava version "1.5.0_09" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03) Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing)
The syntax is different on Windows, but the output is similar.
C:\>%JAVA_HOME%\bin\java -versionjava version "1.5.0_09" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03) Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing)
The command line tool depends on an environment variable (AWS_AUTO_SCALING_HOME) to locate
supporting libraries. You'll need to set this environment variable before you can use the tool.
To set the AWS_AUTO_SCALING_HOME Environment Variable
Set AWS_AUTO_SCALING_HOME to the path of the directory into which you unzipped the command
line tool. This directory is named as-w.x.y.z
(w, x, y, and
z are version/release numbers) and contains
subdirectories named bin and lib.
The following Linux/UNIX example sets AWS_AUTO_SCALING_HOME for a directory named
as-1.0.12.0 in the /usr/local directory.
$exportAWS_AUTO_SCALING_HOME=/usr/local/as-1.0.12.0
The following Windows example sets AWS_AUTO_SCALING_HOME for a directory named
as-1.0.12.0 in the C:\CLIs directory.
C:\>setAWS_AUTO_SCALING_HOME=C:\CLIs\as-1.0.12.0C:\>setxAWS_AUTO_SCALING_HOMEC:\CLIs\as-1.0.12.0
Add the tool's bin directory to your system PATH. The rest of this guide
assumes that you've done this.
On Linux and UNIX, you can update your PATH as follows:
$export PATH=$PATH:$AWS_AUTO_SCALING_HOME/bin
On Windows the syntax is slightly different:
C:\>set PATH=%PATH%;%AWS_AUTO_SCALING_HOME%\binC:\>setx PATH %PATH%;%AWS_AUTO_SCALING_HOME%\bin
You must also provide your AWS credentials to the command line tool. The command line tool reads your credentials from a credential file that you create on your local system.
You can either specify your credentials with the
--aws-credential-file parameter every time you issue a
command, or you can create an environment variable that points to the credential
file on your local system. If the environment variable is properly configured, you
can omit the --aws-credential-file parameter when you issue a
command. The following procedure describes how to create a credential file and a
corresponding AWS_CREDENTIAL_FILE environment variable.
To set up security credentials for your command line tool
Log in to the AWS security credentials website.
Retrieve an access key and its corresponding secret key.
Scroll down to the Access Credentials section and select the Access Keys tab.
Locate an active Access Key in the Your Access Keys list.
To display the Secret Access Key, click Show in the Secret Access Key column.
Write down the keys or save them.
If no Access Keys appear in the list, click Create a New Access Key and follow the on-screen prompts.
Add your access key ID and secret access key to the file named
credential-file-path.template:
Open the file credential-file-path.template included in
your command line interface (CLI) archive.
Copy and paste your access key ID and secret access key into the file.
Rename the file and save it to a convenient location on your computer.
If you are using Linux, set the file permissions as follows:
$chmod 600credential-file-name
Set the AWS_CREDENTIAL_FILE environment variable to the fully qualified path of the file you just created.
The following Linux/UNIX example sets AWS_CREDENTIAL_FILE for myCredentialFile in the /usr/local directory.
$exportAWS_CREDENTIAL_FILE=/usr/local/myCredentialFile
The following Windows example sets AWS_CREDENTIAL_FILE for myCredentialFile.txt in the C:\aws directory.
C:\>setAWS_CREDENTIAL_FILE=C:\aws\myCredentialFile.txtC:\>setxAWS_CREDENTIAL_FILEC:\aws\myCredentialFile.txt
By default, the Auto Scaling command line interface (CLI) uses the Eastern United
States Region (us-east-1) with the
autoscaling.us-east-1.amazonaws.com service endpoint URL. If your
instances are in a different region, you must specify the region where your
instances reside. For example, if your instances are in Europe, you must specify the
eu-west-1 Region by using the --region eu-west-1 parameter or by
setting the AWS_AUTO_SCALING_URL environment variable.
This section describes how to specify a different region by changing the service endpoint URL.
To specify a different region
To view available regions go to Regions and Endpoints in the Amazon Web Services General Reference.
If you want to change the service endpoint, set the AWS_AUTO_SCALING_URL environment
variable.
The following Linux/UNIX example sets AWS_AUTO_SCALING_URL to the EU (Ireland) Region.
$exportAWS_AUTO_SCALING_URL=https://autoscaling.eu-west-1.amazonaws.com
The following Windows example sets AWS_AUTO_SCALING_URL to the EU (Ireland) Region.
C:\>setAWS_AUTO_SCALING_URL=https://autoscaling.eu-west-1.amazonaws.comC:\>setxAWS_AUTO_SCALING_URLhttps://autoscaling.eu-west-1.amazonaws.com
To test your Auto Scaling installation and configuration
On your Linux or Windows workstation, open a new command prompt.
Type the command as-cmd.
You should see output similar to the following:
Command Name Description
------------ -----------
as-create-auto-scaling-group Create a new Auto Scaling group.
as-create-launch-config Creates a new launch configuration.
as-create-or-update-tags Create or update tags.
as-delete-auto-scaling-group Deletes the specified Auto Scaling group.
as-delete-launch-config Deletes the specified launch configuration.
as-delete-notification-configuration Deletes the specified notification configuration.
as-delete-policy Deletes the specified policy.
as-delete-scheduled-action Deletes the specified scheduled action.
as-delete-tags Delete the specified tags
as-describe-adjustment-types Describes all policy adjustment types.
as-describe-auto-scaling-groups Describes the specified Auto Scaling groups.
as-describe-auto-scaling-instances Describes the specified Auto Scaling instances.
as-describe-auto-scaling-notification-types Describes all Auto Scaling notification types.
as-describe-launch-configs Describes the specified launch configurations.
as-describe-metric-collection-types Describes all metric colle... metric granularity types.
as-describe-notification-configurations Describes all notification...given Auto Scaling groups.
as-describe-policies Describes the specified policies.
as-describe-process-types Describes all Auto Scaling process types.
as-describe-scaling-activities Describes a set of activit...ties belonging to a group.
as-describe-scheduled-actions Describes the specified scheduled actions.
as-describe-tags Describes tags
as-describe-termination-policy-types Describes all Auto Scaling termination policy types.
as-disable-metrics-collection Disables collection of Auto Scaling group metrics.
as-enable-metrics-collection Enables collection of Auto Scaling group metrics.
as-execute-policy Executes the specified policy.
as-put-notification-configuration Creates or replaces notifi...or the Auto Scaling group.
as-put-scaling-policy Creates or updates an Auto Scaling policy.
as-put-scheduled-update-group-action Creates or updates a scheduled update group action.
as-resume-processes Resumes all suspended Auto... given Auto Scaling group.
as-set-desired-capacity Sets the desired capacity of the Auto Scaling group.
as-set-instance-health Sets the health of the instance.
as-suspend-processes Suspends all Auto Scaling ... given Auto Scaling group.
as-terminate-instance-in-auto-scaling-group Terminates a given instance.
as-update-auto-scaling-group Updates the specified Auto Scaling group.
help
version Prints the version of the CLI tool and the API.
For help on a specific command, type '<commandname> --help'
This completes your installation and configuration of the Auto Scaling command line tools. You're ready to start accessing Auto Scaling using the command line interface (CLI). For descriptions of all the Auto Scaling commands, see Auto Scaling Quick Reference Card.
