管理单个简单aws预算的工具
awsbudget的Python项目详细描述
awsbudget
awsbudget
是一个小的python命令行实用程序,用于创建简单的AWS Budgets。
目前,这个工具是为解决一个非常简单的用例而构建的—您需要创建一个single预算(美元),它有三个级别的通知:
- 你预计花费超过预算的80%。
- 您已花费超过预算的70%
- 你花了100%的预算
您希望这些通知直接转到电子邮件地址(而不是sns主题)。
在幕后,我们使用template in this repo创建一个cloudformation堆栈,在绑定到您的帐户的默认区域中管理此预算。
此工具使用boto3向aws发出请求。如果您无法验证到正确的帐户,请注意boto3
在a few different places中查找您的aws凭据和配置文件信息。
安装
在目标python虚拟环境中,运行
pip install awsbudget
或者git clone
这个存储库,然后从repo的根目录运行
pip install .
用法
运行awsbudget --help
获得完整的选项列表。
您可以通过直接将所有必需的数据作为命令行选项传递来创建预算:
awsbudget --new --admin_email admin@host.com --budget 20
或者您可以运行
awsbudget --new
工具将以交互方式提示您输入数据:
$ awsbudget --new --profile personal
Please enter the email address where you'd like budget notifications sent: admin@host.com
Sending notifications to admin@host.com
Enter your budget in USD: 20
Creating a new budget of $20
Created CloudFormation stack to manage budgets: arn:aws:cloudformation:us-east-1:account-id:stack/aws-budgets/stack-id
注意,可以指定awsbudget
使用在aws配置文件中定义的特定aws配置文件(例如~/.aws/config
)。
awsbudget --new --profile personal
这在为多个aws帐户创建预算时非常有用。