safeaws cli
1.0.0
一個 AWS CLI 包裝器,可協助您避免 Amazon Bedrock 大型語言模型的常見錯誤和陷阱,根據命令文件檢查命令參數。
作為 AWS 用戶,有時盲目執行線上發現或從 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 | 用於基岩模型的 AWS 區域 | us-east-1 |
SAFEAWS_BEDROCK_MODEL_ID | 用於 AI 檢查的基岩模型 ID | anthropic.claude-3-haiku-20240307-v1:0 |
SAFEAWS_ANTHROPIC_VERSION | 人擇 API 版本 | bedrock-2023-05-31 |
SAFEAWS_MODEL_MAX_TOKENS | 生成的最大代幣數量 | 1024 |
SAFEAWS_TEMPERATURE | 法學碩士申請溫度 | 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 識別的任何潛在問題或疑慮。然後系統會提示您確認是否要執行該命令。