Cloudformation Seed
======
[![Build Status](https://travis-ci.org/Innablr/cloudformation-seed.svg?branch=master)](https://travis-ci.org/Innablr/cloudformation-seed)
Preface
------
This is a script that will help you deploy your Cloudformation project without hassle:
* Handle Cloudformation deployments of any scale
* Allow to do multiple deployments of the same code with a different installation name
* Automate Lambda code handling
* Get rid of hard dependencies of Cloudformation Exports, instead pass around Output values between stacks
* Package the whole deployment in a Docker image and version it
It will:
* Automatically create an S3 bucket according to the project name
* Upload the Cloudformation templates into the bucket
* Package and checksum your Lambda code and upload it into the bucket
* Upload arbitrary artifacts into the bucket so that they are available to your deployment
* Create and manage Cloudformation stacks
* Create, roll out and manage Stacksets
Requirements
------
You need a Mac or a Linux machine/VM to run the Seed. Windows is not supported, but it may work on Windows too if you really want it to.
You need to have Docker on the workstation.
Every Cloudformation template you use has to have 4 mandatory parameters that will be supplied by the Seed:
1. `TemplatesS3Bucket` - the Seed will automatically create an S3 bucket and every template will have its name passed down in this parameter, so it can be made available to Lambda functions, autoscaling groups, e.t.c.
2. `InstallationName` - installation name is what makes you able to deploy your project multiple times without name clashes. Every template will have it in this parameter and you have to use it in the names of your resources to make them unique across multiple installations
3. `RuntimeEnvironment` - name of the runtime environment (read *Deployment configuration*)
4. `Route53ZoneDomain` - DNS domain associated with your deployment. The Seed doesn't require it to exist, you can use it as part of your resource naming convention
Here's a snippet you can copy and paste:
```
Parameters:
TemplatesS3Bucket:
Type: String
Description: S3 Bucket with the components templates
InstallationName:
Type: String
Description: Unique DNS stack installation name
RuntimeEnvironment:
Type: String
Description: The runtime environment config tag
Default: dev
Route53ZoneDomain:
Type: String
Description: Route53 zone domain that represents the environment
```
Quick start
------
### First things first:
1. Create a new directory for your project
2. Copy everything from the `examples` directory to the root of the project
3. Edit `parameters/dev.yaml` to your needs
4. Add more templates with `.cf.yaml` extensions under the `cloudformation` directory and include them in `parameters/dev.yaml`
### Finally:
Authenticate to AWS using your method of choice, make sure that you have set the AWS Region you need for deployment. Run `cloudformation-seed -c my-project -i x0 -e dev -d my.domain.cld deploy`
### Optionally:
Take the dockerfiles and makefiles from the `examples` directory and massage them around to suit your needs.
Deep dive
------
### Seed bucket
The Seed will automatically create an S3 bucket for operating the deployment. The name of the bucket is derived from the installation name and project name from `Makefile.particulars`. The name of the bucket will be passed down to every Cloudformation template in your deployment as `TemplatesS3Bucket`
### Deployment configuration
The `RUNTIME_ENVIRONMENT=dev` clause in the deployment directive points to the configuration file `dev.yaml` located under the `parameters` directory.
You can have multiple runtime environments for the same project with different configuration, for example if you have *dev*, *test* and *prod* environments that reuse the same Cloudformation but need different configuration, for example VPC and subnet IDs.
A runtime environment is a YAML file that:
* defines the sequence in which the Cloudformation stacks will be deployed
* sets parameters for the Cloudformation stacks
The runtime environment contains two sections:
#### `common-parameters`
In this section you can specify Cloudformation parameters that will be picked up by every stack in the deployment as a default value (i.e. if a stack has the same parameter on it it will take precedence)
Example:
```
common-parameters:
VpcId: vpc-00000000
```
You can use `!StackOutput` (read below) in `common-parameters` and it will work as expected.
Instead of `common-parameters` you can also use YAML anchors like this:
```
SAMLUsername: &SAML_USERNAME okta_sso
stacks:
- name: centralservices-iam-set
type: stackset
template: sets/iam.cf.yaml
parameters:
SSMLogsLambdaS3Key: !LambdaZip ssmLogsConfig.zip
SAMLUsername: *SAML_USERNAME
```
You can also tag your stacks/stacksets by defining your tags as a dictionary and referencing them using the YAML anchors within your stacks like this:
```
tags_a: &TAGSA
testkey1: testvalue1
testkey2: testvalue2
tags_b: &TAGSB
testkey3: testvalue3
stacks:
- name: example-stackset-template
type: stackset
template: sets/example-stackset-template.cf.yaml
rollout:
- account: '000000000000'
tags: *TAGA
- name: my-project-kms-decrypt-lambda
template: support/kms-parameters-lambda.cf.yaml
parameters:
LambdaSourceS3Key: !LambdaZip kmsParameters.zip
tags: *TAGSB
```
#### `stacks`
Main configuration where you describe the Cloudformation stacks you want to deploy.
Example:
```
stacks:
- name: in-cld-managed-zone # name of the CF stack, INSTALLATION_NAME will be prepended
template: centralservices/r53-zone.cf.yaml # CF template relative to cloudformation directory
parameters: # Parameters to the CF stack
ManagedZoneDomainName: in.cld
ManagingAccountArns: # List parameters turn into comma-separated values
- arn:aws:iam::000000000000:root
- arn:aws:iam::111111111111:root
- arn:aws:iam::222222222222:root
- name: in-cld-provisioning # name of CF stack, INSTALLATION_NAME will be prepended
template: centralservices/r53-provisioning.cf.yaml # CF template relative to cloudformation directory
parameters:
LambdaSourceS3Key: !LambdaZip provisionR53.zip # points to the lambda function under src/provisionR53 (read below)
SharedServiceR53ZoneRoleArn: !StackOutput in-cld-managed-zone.ManagedZoneCrossAccountRole # will take the output called ManagedZoneCrossAccountRole from the above stack called in-cld-managed-zone
Route53DomainName: !StackOutput in-cld-managed-zone.ManagedZoneDomainName
ExportOutputs: 'false' # put numbers and booleans in quotes
- name: centralservices-iam-set
type: stackset # set type to stackset
template: sets/iam.cf.yaml
parameters: # parameters to the StackSet
SSMLogsLambdaS3Key: !LambdaZip ssmLogsConfig.zip
SAMLUsername: *SAML_USERNAME
SAMLProviderName: *SAML_PROVIDER_NAME
pilot: # when StackSet is updated only update instances in these accounts
accounts:
- '000000000000'
rollout: # manage StackSet instances
- account: '000000000000'
override: # parameter override
Route53ZoneDomain: prod.innablr.lan
- account: '111111111111'
regions: # in this account it goes into two regions
- ap-southeast-2
- eu-west-1
override:
Route53ZoneDomain: preprod.innablr.lan
- account: '222222222222'
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共22个文件
py:11个
txt:6个
pkg-info:2个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
资源分类:Python库 所属语言:Python 资源全名:cloudformation-seed-0.13.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![whl](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
共 22 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/277f6345dca0446498fbbc03843436aa_qq_38161040.jpg!1)
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)