コマンド引数をコマンドドキュメントと照合して、Amazon Bedrock の大規模言語モデルでよくある間違いや落とし穴を回避するのに役立つ AWS CLI ラッパー。
AWS ユーザーは、オンラインで見つけた CLI コマンドや Stack Overflow などのソースからコピーした CLI コマンドを盲目的に実行すると、意図しない結果、データ損失、経済的損失、またはセキュリティ リスクにつながる可能性があります。
safeaws-cli
Amazon Bedrock の AI 言語モデルを活用して CLI コマンドを分析し、ヘルプテキストを取得し、実行前に潜在的な問題や懸念事項を特定することで、自信を持って AWS コマンドを実行できるようにします。落とし穴を軽減するセーフティネットを提供することで、 safeaws-cli
ユーザーが AWS を安全に探索できるようにし、CLI を使用するためのより情報に基づいたアプローチを促進します。
しかし、当然のことながら、GenAI モデルの実行にはコストがかかります。使用する前に必ず評価してください。
python3 -m pip install boto3
SAFEAWS_BEDROCK_MODEL_ID
を参照してください。 変数 | 説明 | デフォルト |
---|---|---|
SAFEAWS_AWS_PROFILE | 使用するAWSプロファイル | None |
SAFEAWS_AWS_REGION | Bedrock モデルに使用する AWS リージョン | us-east-1 |
SAFEAWS_BEDROCK_MODEL_ID | AIチェックに使用するBedrockモデルID | anthropic.claude-3-haiku-20240307-v1:0 |
SAFEAWS_ANTHROPIC_VERSION | Anthropic API バージョン | bedrock-2023-05-31 |
SAFEAWS_MODEL_MAX_TOKENS | 生成する最大トークン数 | 1024 |
SAFEAWS_TEMPERATURE | LLM の温度 | 0.5 |
Amazon Bedrock に対する認証の場合は、推奨されませんが、環境変数AWS_ACCESS_KEY_ID
およびAWS_SECRET_ACCESS_KEY
に AWS アクセス キーと秘密キーを設定することもできます。
セキュリティのため、 sso-session
セットアップし、認証にAWS_PROFILE
環境変数を使用することをお勧めします。
#! /bin/bash
sudo curl https://raw.githubusercontent.com/gabrielkoo/safeaws-cli/main/safeaws.py
-o /usr/local/bin/safeaws &&
sudo chmod +x /usr/local/bin/safeaws
safeaws-cli
使用するには、AWS CLI コマンドの先頭にsafeaws
を付けます。
safeaws <aws-cli-command>
例えば:
> safeaws s3 cp file.txt s3://my-bucket/path/
The provided command appears to be correct and complete. However, here are a few points to consider:
1. Ensure that the file 'file.txt' exists in the local directory from where the command is being executed.
2. Verify that the S3 bucket 'my-bucket' and the 'path/' prefix exist, and that you have the necessary permissions to upload the file to that location.
3. Consider adding the '--acl' parameter to set the appropriate access control list (ACL) for the uploaded object, if required.
4. Evaluate whether any additional metadata, such as content-type or cache-control, should be set for the uploaded object using the respective parameters.
5. Assess if the default storage class ('STANDARD') is appropriate for your use case, and consider using a different storage class if necessary.
Do you want to execute the command? (y/N) y
<Execution results shown here>
このスクリプトは、指定された AWS CLI コマンドのヘルプ テキストを取得し、コマンド引数とともに指定された Bedrock モデルに送信し、AI によって特定された潜在的な問題や懸念事項を表示します。コマンドを実行するかどうかを確認するプロンプトが表示されます。