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 识别的任何潜在问题或疑虑。然后系统将提示您确认是否要执行该命令。