并行创建/更新/删除aws cloudformation堆栈
aloisius的Python项目详细描述
关于
aloisius帮助您管理aws云信息堆栈的生命周期。它 允许您使用一个堆栈的输出作为其他堆栈的输入参数。 还有其他的工具可以让你这么做,比如积云或者Ansible, 但我找不到一个不需要你使用yaml或jinja2的。它 是一个纯python库,用于 对流层,但您也可以将其与任何cloudformation json模板一起使用。
许可证
bsd 2子句许可证:http://opensource.org/licenses/BSD-2-Clause
安装
aloisius可以通过python的pip发行系统安装 发布:
$ pip install aloisius
或者,可以通过克隆此存储库来运行use setup.py进行安装 并发布:
# python setup.py install
示例
创建包含rds的vpc的简单示例如下:
#!/usr/bin/env python from aloisius import Stack import boto3 # I keep my troposphere templates as modules in a package. from templates.vpc import template as template_vpc from templates.rds import template as template_rds # You can set your own boto3 session and override the default. E.g: # aloisius.session = boto3.session.Session(profile_name: "PROFILE") # I normally put some constants and helper functions here. app_name = 'myapp' region_name = 'eu-central-1' stack_name = lambda x: '-'.join([app_name, region_name, x]) vpc = Stack( StackName=stack_name('vpc'), TargetState='present', RegionName=region_name, TemplateBody=template_vpc.to_json(), ) rds = Stack( StackName=stack_name('rds'), TargetState='present', RegionName=region_name, TemplateBody=template_rds.to_json(), Parameters={ # You can use outputs of previously created stacks as parameters. 'VpcId': vpc.outputs['VpcId'], 'PrivateSubnets': vpc.outputs['PrivateSubnets'], # More parameters here. }, ) # You can wait for all of the stacks to finish aloisius.stacks.wait() # Or you can check if they were all applied successfuly if not aloisius.stacks.success(): exit(1) # Or you can iterate over their outputs for stack in aloisius.stacks: for key, value in stack.outputs.items(): print "{0}={1}".format(key, value)
为什么不应该使用aloisius
- 没有太多文档(但代码中有注释)。
为什么要使用aloisius
- 你可以找到一些虫子来帮助它变得更好。
- 并行堆栈创建/删除。
- 与对流层很好地集成:没有json和yaml。