aws-history
Search and display past AWS CLI commands
TLDR
List commands history with command IDs
Display events related to a specific command given a command ID
SYNOPSIS
aws-history [OPTIONS] [NUM_COMMANDS]
PARAMETERS
-h, --help
Display usage information and exit.
-n NUM, --num NUM
Limit output to last NUM AWS commands (default: 20).
--format json|table
Output format for history entries.
--clear
Remove AWS commands from shell history (use with caution).
--export FILE
Export history to a specified file.
DESCRIPTION
The aws-history command is not a standard Linux utility but a common custom script or alias used by AWS CLI users to filter and display shell history entries starting with aws. It simplifies reviewing past AWS commands for auditing, debugging, or reuse. Typically implemented as history | grep '^aws' or enhanced with options for output formatting, timestamps, or export to files. Found in dotfiles, GitHub gists, or personal bin directories rather than system packages. It leverages Bash/Zsh history mechanisms to extract AWS-specific invocations, helping track resource changes, API calls, and configurations over time. Usage assumes AWS CLI is installed and shell history enabled.
CAVEATS
Not a built-in command; requires manual setup. Depends on shell history size (HISTSIZE). May miss commands if history is disabled or aliased differently. Security risk if sharing output with sensitive AWS credentials.
EXAMPLE USAGE
aws-history -n 10
Shows last 10 AWS commands.
aws-history --export ~/aws_log.txt
Exports full history to file.
SETUP
Add alias to ~/.bashrc: alias aws-history='history | grep "^ *\d* *aws" | tail -20'
Reload with source ~/.bashrc.
HISTORY
Emerged in AWS user communities around 2015 with CLI v1 popularity. Popularized via GitHub scripts for DevOps workflows; no official AWS development.


