AWS CLI is the standard way to interact with AWS services using commands in your command-line shell. AWS has over 200 fully-featured services. So, it is almost impossible to remember every CLI command and their parameters. This requires us to refer the AWS CLI documentation again and again.
The in-built "Auto-prompt" feature provided by AWS CLI (v2) can be easily used to minimise the number of times we refer the CLI documentation.
Note: The AWS CLI (v1) does not support this feature. We can easily check the current version of our AWS CLI using the following command:
Auto-prompt in action 🧑💻
Just type the partial command that you know, and then click "Enter" to kick-in this feature 👇
Modes of Auto-prompt
Before configuring this, lets talk about the two modes of auto-prompt feature that are provided by AWS CLI:
- Full mode: This mode uses the auto-prompt feature each time user runs an AWS command which can be either a complete command or an incomplete command. This can be done manually using the --cli-auto-prompt parameter or can be enabled permanently using the configuration file.
- Partial mode: This mode uses the auto-prompt feature if a command is incomplete or cannot be run due to a client-side validation error. This mode is useful in scenarios where you only want to be auto-prompted for commands you are unfamiliar with rather than prompted on every command.
Based on my experience, the "Partial mode" for this feature is better than the "Full mode". This helps to avoid any unnecessary prompts if the AWS CLI command you are running is already correct.
The "auto-prompt" feature can be enabled using the following command:
⭐️ Full mode
aws configure set cli_auto_prompt on
⭐️ Partial mode
aws configure set cli_auto_prompt on-partial
After using the above commands, this feature is only enabled for the AWS CLI default profile.
⭐️ Enabling it for a specific AWS CLI profile
We can enable this for a specific AWS CLI profile using the --profile parameter i.e.
aws configure set cli_auto_prompt on-partial --profile <profile-name>
And thats it. We are done learning another less known but an useful feature while working with AWS.
Now you can enjoy this feature and reduce the amount of time you spend referring to the AWS CLI documentation.
👋 Enjoyed the article? Reach out to me anytime in the comments below or on Twitter for any further discussion or feedback.