The aws history command is a feature of the AWS Command Line Interface (CLI) that allows you to print the command-line history for AWS CLI commands. This feature provides a record of the history of AWS CLI commands you have executed, but it’s important to note that the command history feature must be enabled for this to work.
Here are the key points to understand about the aws history command:
- Command History: When the command history feature is enabled, the AWS CLI records the commands you execute in a history file. This file stores a chronological list of the AWS CLI commands, along with their associated timestamps.
- Printing Command History: By running the aws history command, you can retrieve and display the contents of the command history file. It presents the list of previously executed AWS CLI commands, making it easy to review your command history.
- Filtering and Sorting: The aws history command offers options to filter and sort the command history. You can specify filters based on time intervals, specific AWS services, or command keywords to narrow down the displayed history. Sorting options allow you to organize the history by timestamp or other criteria.
- Output Formats: The command history can be displayed in different output formats, such as table, JSON, or text. You can choose the format that best suits your needs or integrate the output with other tools or scripts.
It’s worth noting that the command history feature must be explicitly enabled for the AWS CLI to record and store command history. If the feature is not enabled, running aws history will not display any command history.
aws history Command Examples
1. List commands history with command IDs:
# aws history list
2. Display events related to a specific command given a command ID:
# aws history show command_id