Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells, Featured, Virtualization

AWS CLI Cheat Sheet

Submitted by on August 14, 2018 – 4:18 pm

The installation and configuration process for AWS CLI is fairly simple. The package itself is installed with pip (yum -y install python-pip):

Selecting what you need from the output can be accomplished via awscli filters and queries; using the excellent jq JSON processor; or just using awk, sed, and whatever other standard shell tools you like. My preference is to keep awscli queries simple and do most of the formatting in the shell.

The first time you run awscli you will be prompted to provide your API credentials. You would need to supply the AWS Access Key ID, the AWS Secret Access Key, and the default region the can be modified from command line along with other variables.

You can obtain this info by logging into your AWS account, clicking on your username in the upper right-hand corner ➡ My Security Credentials ➡ Users ➡ Select your username ➡ Security Credentials ➡ Create access key.

In the examples below I used a variety of methods for massaging the output. Not because this was the most efficient way of doing things, but just to illustrate the available options.

List running instances

List all instances in a table format

See if any running instances have scheduled events

List stopped instances and reason why

List AWS Dashboard users

List EBS volumes for a specific instance

List EBS volumes for all instances

List snapshots of volumes for a specific instance

[su_note]NOTE: It would appear that particularly old snapshots are not reported via the CLI, while still visible in the Web UI. I am not sure if this is by design, or if this is just some issue on my end. I briefly consulted the documentation, but did not find any mention of this behavior.[/su_note]

Describe snapshots of volumes for a specific instance

Generate snapshot report for all running instances

Make a screenshot of the instance’s terminal and email it

 

Print Friendly, PDF & Email

Leave a Reply