AWS Chatbot から AWS ドキュメントやリソースを検索することが可能になりました!

2023.03.31

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

トラブル対応や調べものをしている時、気が付くとブラウザのタブがすごいことになっていることがありませんか?(私はあります。。)
あと複数ツールを利用していると、画面を行ったり来たりしているうちに...「あのツールの画面、どこにいった?」と迷子になることすらあります。

今回、まさにこんな悩みを解消してくれる機能が AWS Chatbot に追加されました。

When issues occur customers need to lookup product documentation or support articles to diagnose and remediate the issues. With this feature, customers can ask questions in natural language from chat channels to get answers to these issues without switching context to the AWS Console or other tools.

↓↓↓ 機械翻訳 ↓↓↓

問題が発生した場合、お客様は製品のドキュメントやサポート記事を参照し、問題を診断・改善する必要があります。この機能により、お客様はAWS Consoleや他のツールにコンテキストを切り替えることなく、チャットチャネルから自然言語で質問し、これらの問題に対する答えを得ることができます。

引用元: AWS Chatbot now supports search of AWS resources and AWS content

AWS Chatbot に質問をすることで、AWS ドキュメント検索や AWS アカウント内のリソースを取得してくれるようです。ChatOps が捗る機運がしますね。

やってみる

前提条件

今回は Slack に AWS Chatbot が設定されている状態から進めます。

[参考情報]

もう一つは、リソース検索には AWS Resource Explorer が有効になっている必要があります。

[参考情報]

サンプル実行

何はともあれ、まずはやってみたいですね。リリース記事にあるサンプルを実行してみましょう。

  • ドキュメント参照編

Learn more を選択することで、ドキュメントへ遷移します。

  • リソース検索編

関連リソース数が表示され、フィルター機能が提供されるようです。

詳細に指定して、 Filter を選択するとリソースリストが表示されました。

おおぉ、、これ日本語はどうなんだろう? 日本語は難しいだろうなと思いつつも試してみましょう。

対応言語(日本語)

サンプルで実施した英語文書を機械翻訳した内容で実行してみます。

  • ドキュメント参照編

  • リソース検索編

結果は、どちらも出来ませんでした。。

現時点(2023/03/31)では英語によるコミュニケーションが前提のようです。

エラーメッセージからドキュメント検索するシーンや、リソース表示はある程度定型分として備えておけば、利用自体は出来そうですね。

EC2 を利用している際に、キャパシティ不足で起動できないケースを想定してエラーメッセージ(InsufficientInstanceCapacity)を用いて検索してみます。

いくつかの候補リストが表示されました。求めていたのは 2つ目だったので、RDS が上段に来るのはアレではありますが、ユースケースとしては良さそうです。

他に何が出来る?

AWS Chatbot を触れるのは久しぶりなので、他には何が出来るかを確認してみます。
現時点(2023/03/31)で、AWS Chatbot から実行可能な操作は下記の6つのようです。

Actions you can perform include:

・ Running CLI commands
・ Asking questions about AWS services and troubleshooting guidance
・ Finding your AWS resources
・ Creating command aliases
・ Responding to interactive messages
・ Running CLI commands to use different AWS services from chat channels
For example, you can retrieve diagnostic information, invoke Lambda functions, and create support cases for your AWS resources

引用元: Performing actions

今回のアップデート以外だと Creating command aliases は試したことがない機能だったので、今度試してみたいと思います。

コマンドでの help も見てみます。

I can run most commands for you using standard AWS CLI syntax:
@aws service operation --parameter-1 foo --parameter-2 bar

For example, you can type:
@aws cloudwatch describe-alarms --state-value ALARM

Or enter values one parameter at a time by first providing an operation. For example, if you type:
@aws support create-case

I will prompt you for subject, and then you type:
@aws subject Can't ssh to EC2 instance

and then I will prompt for the next value:
@aws communication-body I created an EC2 instance and can't ssh to it. Please help.

until all required parameters are fulfilled.
You can alias commands to an easy-to-use shortcut. For example, if you type:
@aws alias create my-lambda-shortcut lambda invoke --function-name MyFunction --payload {"key":"$payload-value"}

You can then run your lambda command by typing:
@aws run my-lambda-shortcut --payload-value value

You can run:
@aws alias --help for more information

You can also ask me questions about AWS services. You can type:
@aws how do I create a transit gateway?
@aws How to set reserved concurrency setting for a lambda?

You can now find your AWS resources by typing:
@aws What EC2 Resources do I have?

You can get help for a service or operation by including --help.
• Service help:
@aws ec2 --help

• Operation help:
@aws lambda invoke --help

To see a list of available AWS services, enter:
@aws help services

To see a list of AWS accounts configured for this channel or select a new account to use for commands, enter:
@aws set default-account

To provide feedback to AWS Chatbot, enter:
@aws feedback <text>

To get a link to map a new user-specific IAM role, enter:
@aws switch-roles

実行できないサービスやアクションも存在しますが、 特定の運用(特にインシデント発生時の初期対応)操作が広く実施可能な印象と受けます。

さいごに

巷で流行している ChatGPT といい、Chat というツールを通して仕事をする機会がこれからも増えていきそうですね。