aws公式の手順が分かりづらかったのでまとめました。
環境
- M1 mac
- zsh
- ARM版homebrew
- aws cli v2
手順
-
aws_completerのパスを確認する。
$ which aws_completer
/opt/homebrew/bin/aws_completer
1. /usr/local/binにシンボリックリンクを作成する
```
$ cd /usr/local/bin
$ ln -s /opt/homebrew/bin/aws_completer
-
.zshrcに設定を追加する
$ vim ~/.zshrc
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
compinit
complete -C '/usr/local/bin/aws_completer' aws
1. 確認する
$ source ~/.zshrc
$ aws dynamodb [TAB]
batch-execute-statement describe-table restore-table-to-point-in-time
batch-get-item describe-table-replica-auto-scaling scan
batch-write-item describe-time-to-live tag-resource
create-backup disable-kinesis-streaming-destination transact-get-items
create-global-table enable-kinesis-streaming-destination transact-write-items
create-table execute-statement untag-resource
delete-backup execute-transaction update-continuous-backups
delete-item export-table-to-point-in-time update-contributor-insights
delete-table get-item update-global-table
describe-backup list-backups update-global-table-settings
describe-continuous-backups list-contributor-insights update-item
describe-contributor-insights list-exports update-table
describe-endpoints list-global-tables update-table-replica-auto-scaling
# 参考
[公式ドキュメント](https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/cli-configure-completion.html#cli-command-completion-windows)
[AWS CLI v2のコマンド補完を有効にする](https://qiita.com/charon/items/3788ea6d48adc23ae1dd)