Get started Bring yourself up to speed with our introductory content.

When and how to use the AWS Command Line Interface

Sometimes a command line is needed for application management. Learn how and when to use the AWS Command Line Interface.

Life is easier with graphical user interfaces (GUIs) for those who don't care for command lines. However, there...

are times that command line interfaces (CLIs) are needed, especially when automating system administration procedures. The AWS Command Line Interface allows you to monitor your EC2 instance, S3 storage and other AWS resources without navigating through the command console.

The first step to using the AWS CLI is to install a local copy. Installation instructions are online for Windows, Mac, Unix and Linux clients. An MSI installer is available for Windows; the other platforms install AWS CLI using pip, the Python package installer. No worries if you don't program in Python, you just have to run a handful of shell commands in a terminal window.

AWS CLI commands require that you specify your login credentials in one of three ways: using the AWS configure command, via a credentials profile file or by setting environment variables. Unlike many Linux/Unix remote commands, you cannot specify your login credentials in the AWS CLI command line.

You can also specify your default region and output format preferences with the AWS configure command.

All AWS CLI commands start with "AWS," followed by a command and, optionally, a subcommand and then options and parameters. For example, the command "AWS describe-instance-status" will describe all of your instances, while "AWS describe-instance-s –instance-ids i-7381234c" will output the description of the instance with id i-7381234c.

You can monitor instances using status checks and by watching for particular events. The describe-instance-status provides both system and instance checks. Amazon resolves system problems, such as loss of power or hardware problems on the physical host. You have to resolve instance problems, like misconfigurations or problems with a corrupt file system. The four events you can watch for are reboots, system maintenance, instance retirement and instance stop.

There are also specialized commands for the status of reserved instances and spot instance requests.

The AWS CLI also provides a command for monitoring volumes attached to EC2 instances: the command "AWS EC2 describe-volume-status." This command will return a status of OK, impaired, warning or insufficient-data.

AWS provides "describe" commands for many other resources, including key pairs, network instances, virtual private cloud, images, snapshots and more.

AWS CloudWatch collects detailed statistics on your instances and related resources. Using CloudWatch, you can collect metrics and save them over time. Basic monitoring is free, and you can opt for more detailed monitoring for a fee -- see the AWS pricing page for details. CloudWatch provides alarms so you can receive a notification when a resource exceeds a particular threshold, such as CPU utilization on an EC2 instance exceeding 80%.

CloudWatch is especially useful for monitoring specific aspects of your various AWS resources. For example, you can monitor CPU utilization on EC2 instances, throughput in DynamoDB, and free storage space on RDS instances. You can also monitor CloudFront, Elastic MapReduce, Elastic Load Balancing, OpWorks, Route 53, Simple Notification Service, Simple Queue Service and the Simple Workflow service.

The CloudWatch command line interface allows you to create and delete alarms, get statistics on a particular metric, disable alarm actions and perform other operations.

The command "mon-get-stats" retrieves the values of a particular metric you are monitoring. The period, start-time and end-time options are especially useful. The period option specifies the granularity of results in 60-second increments. The start and end times specify the time range of the data retrieved. You also specify whether you want the average, sum, maximum or minimum of the metric using the statistics option.

Monitoring from the command line allows cloud administrators to script many repetitive tasks. When combined with AWS CloudWatch, command line scripts can be especially helpful in ensuring administrators are informed any time a resource begins to exceed capacity or needs other attention.

This was last published in January 2015

Dig Deeper on AWS CloudWatch and application performance monitoring

Join the conversation

2 comments

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What's your experience using the AWS Command Line Interface?
Cancel
So far, my company's experience using the AWS Command Line has not made it past the research phase. While the technology is appealing, we have yet to find a reason to implement it into our existing platform and infrastructure. We hope to get the needed reviews and information from other companies similar to ours that are using the AWS Command Line Interface and see what they have found to be effective with the technology.
Cancel

-ADS BY GOOGLE

SearchCloudApplications

TheServerSide.com

SearchSoftwareQuality

SearchCloudComputing

Close