Search code examples
amazon-web-servicesaws-clibash-completion

How do I avoid the AWS CLI completion UI for complete commands?


How does the AWS CLI command completion setting cli_auto_prompt = on-partial work? In my ~/.aws/config I have

[default]
region = us-west-2
output = json
cli_auto_prompt = on-partial
cli_history = enabled
cli_timestamp_format = iso8601

But when I enter complete commands such as

aws iam list-groups

and press enter, I still get the completion UI. As I understand the documentation, which says

on-partial uses partial auto-prompt mode. If a command is incomplete or cannot be run due to client-side validation errors, auto-prompt is used. This mode is particular useful if you have pre-existing scripts, runbooks, or you only want to be auto-prompted for commands you are unfamiliar with rather than prompted on every command.

I should not have had the completion UI interrupt me, and instead the command should just have been executed.

How do I avoid the AWS CLI completion UI for complete commands?


(The other settings, such as output, and cli_history all work as expected, and respond to changes made in ~/.aws/config.)


$ aws --version
aws-cli/2.7.11 Python/3.10.5 Darwin/20.6.0 source/x86_64 prompt/on
$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin20.6.0)
$ which -a aws
/usr/local/bin/aws
$ ls -l /usr/local/bin/aws
lrwxr-xr-x  1 Tax  admin  31 Jun 25 09:50 /usr/local/bin/aws -> ../Cellar/awscli/2.7.11/bin/aws

Solution

  • Check whether you have the AWS_CLI_AUTO_PROMPT environment variable set somewhere in your ~/.bashrc, ~/.bash_profile, or similar files.

    As you can see in the AWS CLI auto-prompt documentation, this variable overrides the cli_auto_prompt setting in the ~/.aws/config file.

    If things still look spooky after that, try completely uninstalling and reinstalling the AWS CLI.