Proceed with the following steps to install and configure Auto Scaling Command Line Interface:
1. Set the Java variable in your system:
1. The command-line tool reads an environment variable (JAVA_HOME) on the machine to locate the Java runtime. Either JRE or JDK should be fine with Version 6 or higher. To download Java, go to http://java.oracle.com/.
2. Extract your downloaded Java and set the path using the variable JAVA_HOME to the full path of the directory, which will contain the bin subdirectory. For example, if you have Java installed in the /opt directory, the path should be JAVA_HOME to /opt/jdk for Linux and C:\jdk for Windows.
[ 39 ]
3. To set JAVA_HOME, use the following commands: For Linux:
$export JAVA_HOME=/opt/jre
For Windows:
C:\> set JAVA_HOME=C:\java\jdk1.6.0_6
4. Include the Java directory to your system path before other versions of Java:
For Linux:
$export PATH=$PATH;$JAVA_HOME/bin
For Windows:
C:\> set PATH=%PATH%;%JAVA_HOME%\bin
5. Verify your JAVA_HOME settings: For Linux:
$ JAVA_HOME/bin/java –version
For Windows:
C:\> %JAVA_HOME%\bin\java –version
2. Setting up the CLI tools: To access the Auto Scaling Command Line tools, you need to download it from the AWS site http://aws.amazon.com/cli/ and set it up with your AWS credentials within an instance. You need to just download it and unzip it. No installation is required; it will come as a .zip bundle.
1. The CLI also depends on the environment variable, so, again, we have to set its path with AWS_AUTO_SCALING_HOME:
For Linux: $ export AWS_AUTO_SCALING_HOME=/usr/local/as-1.0.12.0 $ export PATH=$PATH:$AWS_AUTO_SCALING_HOME/bin For Windows: C:\> set AWS_AUTO_SCALING_HOME=C:\CLIs\as-1.0.12.0 C:\> set PATH=%PATH%;%AWS_AUTO_SCALING_HOME%\bin www.itbook.store/books/9781782173632
[ 40 ]
2. The way to use Python for the AWS CLI setup is very easy and became very popular in the developer community as it requires only a single command called pip. It will install AWS CLI tools on your instance. So, the same can be possible for AWS Auto Scaling tools.
pip install awscli
Your environment variables of the Windows machine may reset when you close the terminal window. You may want to set them undyingly using the setx command, which is the same as set.
3. Authenticate your AWS account with the CLI tools:
1. After signing in, you need to create access keys and secret keys for your account. You have to provide these keys to your CLI tools. You can create your AWS secret keys and access ID from https://console.aws.amazon.com/iam/home?#security_ credential.
2. Create one new file called CredentialFile and save your access key ID and secret access key to the file.
3. Provide 600 (read and write for owner only) permission to CredentialFile if you are a Linux user using the following command:
$ chmod 600 CredentialFile
4. Set the AWS_CREDENTIAL_FILE variable based on your file location. Now, you are almost done with setting up the AWS CLI tools for Auto Scaling. So, now you can test the tools on a Windows or Linux machine using the following command:
as-cmd
You should see the output as follows, for your reference:
Command Name Description --- ---
as-create-auto-scaling-group Create a new Auto Scaling group.
as-create-launch-config Creates a new launch configuration.
[ 41 ]
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 activities 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.
[ 42 ]
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'
If you are getting the preceding output, you are done with the setup and are now ready to access Auto Scaling using CLI.