{ "info": { "author": "Alex Bukharov", "author_email": "alex.bukharov@innablr.com.au", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "Cloudformation Seed\n======\n[![Build Status](https://travis-ci.org/Innablr/cloudformation-seed.svg?branch=master)](https://travis-ci.org/Innablr/cloudformation-seed)\n\nPreface\n------\n\nThis is a script that will help you deploy your Cloudformation project without hassle:\n\n* Handle Cloudformation deployments of any scale\n* Allow to do multiple deployments of the same code with a different installation name\n* Automate Lambda code handling\n* Get rid of hard dependencies of Cloudformation Exports, instead pass around Output values between stacks\n* Package the whole deployment in a Docker image and version it\n\nIt will:\n\n* Automatically create an S3 bucket according to the project name\n* Upload the Cloudformation templates into the bucket\n* Package and checksum your Lambda code and upload it into the bucket\n* Upload arbitrary artifacts into the bucket so that they are available to your deployment\n* Create and manage Cloudformation stacks\n* Create, roll out and manage Stacksets\n\nRequirements\n------\n\nYou 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.\n\nYou need to have Docker on the workstation.\n\nEvery Cloudformation template you use has to have 4 mandatory parameters that will be supplied by the Seed:\n\n1. `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.\n2. `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\n3. `RuntimeEnvironment` - name of the runtime environment (read *Deployment configuration*)\n4. `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\n\nHere's a snippet you can copy and paste:\n\n```\nParameters:\n TemplatesS3Bucket:\n Type: String\n Description: S3 Bucket with the components templates\n InstallationName:\n Type: String\n Description: Unique DNS stack installation name\n RuntimeEnvironment:\n Type: String\n Description: The runtime environment config tag\n Default: dev\n Route53ZoneDomain:\n Type: String\n Description: Route53 zone domain that represents the environment\n```\n\nQuick start\n------\n\n### First things first:\n\n1. Create a new directory for your project\n2. Copy everything from the `examples` directory to the root of the project\n3. Edit `parameters/dev.yaml` to your needs\n4. Add more templates with `.cf.yaml` extensions under the `cloudformation` directory and include them in `parameters/dev.yaml`\n\n### Finally:\n\nAuthenticate 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`\n\n### Optionally:\n\nTake the dockerfiles and makefiles from the `examples` directory and massage them around to suit your needs.\n\nDeep dive\n------\n\n### Seed bucket\n\nThe 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`\n\n### Deployment configuration\n\nThe `RUNTIME_ENVIRONMENT=dev` clause in the deployment directive points to the configuration file `dev.yaml` located under the `parameters` directory.\n\nYou 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.\n\nA runtime environment is a YAML file that:\n* defines the sequence in which the Cloudformation stacks will be deployed\n* sets parameters for the Cloudformation stacks\n\nThe runtime environment contains two sections:\n\n#### `common-parameters`\n\nIn 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)\n\nExample:\n\n```\ncommon-parameters:\n VpcId: vpc-00000000\n```\n\nYou can use `!StackOutput` (read below) in `common-parameters` and it will work as expected.\n\nInstead of `common-parameters` you can also use YAML anchors like this:\n\n```\nSAMLUsername: &SAML_USERNAME okta_sso\n\nstacks:\n - name: centralservices-iam-set\n type: stackset\n template: sets/iam.cf.yaml\n parameters:\n SSMLogsLambdaS3Key: !LambdaZip ssmLogsConfig.zip\n SAMLUsername: *SAML_USERNAME\n```\n\nYou 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:\n\n```\ntags_a: &TAGSA\n testkey1: testvalue1\n testkey2: testvalue2\n\ntags_b: &TAGSB\n testkey3: testvalue3\n\n stacks:\n - name: example-stackset-template\n type: stackset\n template: sets/example-stackset-template.cf.yaml\n rollout:\n - account: '000000000000'\n tags: *TAGA\n\n - name: my-project-kms-decrypt-lambda\n template: support/kms-parameters-lambda.cf.yaml\n parameters:\n LambdaSourceS3Key: !LambdaZip kmsParameters.zip\n tags: *TAGSB\n```\n\n#### `stacks`\n\nMain configuration where you describe the Cloudformation stacks you want to deploy.\n\nExample:\n\n```\nstacks:\n - name: in-cld-managed-zone # name of the CF stack, INSTALLATION_NAME will be prepended\n template: centralservices/r53-zone.cf.yaml # CF template relative to cloudformation directory\n parameters: # Parameters to the CF stack\n ManagedZoneDomainName: in.cld\n ManagingAccountArns: arn:aws:iam::000000000000:root\n\n - name: in-cld-provisioning # name of CF stack, INSTALLATION_NAME will be prepended\n template: centralservices/r53-provisioning.cf.yaml # CF template relative to cloudformation directory\n parameters:\n LambdaSourceS3Key: !LambdaZip provisionR53.zip # points to the lambda function under src/provisionR53 (read below)\n SharedServiceR53ZoneRoleArn: !StackOutput in-cld-managed-zone.ManagedZoneCrossAccountRole # will take the output called ManagedZoneCrossAccountRole from the above stack called in-cld-managed-zone\n Route53DomainName: !StackOutput in-cld-managed-zone.ManagedZoneDomainName\n ExportOutputs: 'false' # put numbers and booleans in quotes\n\n - name: centralservices-iam-set\n type: stackset # set type to stackset\n template: sets/iam.cf.yaml\n parameters: # parameters to the StackSet\n SSMLogsLambdaS3Key: !LambdaZip ssmLogsConfig.zip\n SAMLUsername: *SAML_USERNAME\n SAMLProviderName: *SAML_PROVIDER_NAME\n pilot: # when StackSet is updated only update instances in these accounts\n accounts:\n - '000000000000'\n rollout: # manage StackSet instances\n - account: '000000000000'\n override: # parameter override\n Route53ZoneDomain: prod.innablr.lan\n - account: '111111111111'\n regions: # in this account it goes into two regions\n - ap-southeast-2\n - eu-west-1\n override:\n Route53ZoneDomain: preprod.innablr.lan\n - account: '222222222222'\n override:\n Route53ZoneDomain: dev.innablr.lan\n - account: '999999999999'\n regions: [] # this is how you delete an instance\n override:\n Route53ZoneDomain: dontwant.innablr.lan\n\n```\n\n### Automated Lambda functions\n\nIf your deployment contains Lambda function they can be handled by the Seed automatically. In the `examples` directory you can find an example of a Lambda function called `kmsParameters`\n\n1. Create a directory under `src` for your Lambda, say `kmsParameters`\n2. Do the development\n3. Create a `Makefile` in the directory you have created and make sure that **the default target of the Makefile produces a zip-file**, say `kmsParameters.zip`\n4. In your runtime environment configuration use `!LambdaZip kmsParameters.zip` to pass the zip-file name to the CloudFormation template (see the example above)\n\nIf your Lambda function is used in a StackSet and needs to be available from other AWS accounts make sure that you give access to the Seed bucket from those accounts. Refer to the stack `bucket-policy.cf.yaml` that is included in the examples.\n\n### Arbitrary artifacts\n\nIf you want to include any configuration objects for your software or other relatively lightweight artifacts you can create a directory called `config/` under the root of your project and anything you put in this directory will be uploaded in the Seed S3 bucket under a key called `config`.\n\nLet's say you have `config/dev/myapp_cert.pem` and you deploy a runtime configuration called `dev`. The file will be uploaded in the bucket as `config/myapp_cert.pem`.\n\n### Configuration tags\n\nIn the runtime environment configuration you can use the following tags in stack parameters specification:\n\n1. `!LambdaZip kmsParameters.zip` - will pass the correct S3 key to the uploaded kmsParameters.zip, so you can use it in your Lambda resources together with `TemplatesS3Bucket`\n\n2. `!CloudformationTemplate support/bucket-policy.cf.yaml` - works very similar to `!Lambdazip` but for Cloudformation templates. Will pass down the correct S3 key to the specified CloudFormation stack\n\n3. `!StackOutput stack-name.OutputName` - will read the corresponding output from the specified stack and pass it down here. The stack needs to have been created above in the sequence.\n\n4. `!ArtifactVersion`, `!ArtifactRepo` and `!ArtifactImage` - these three tags are used together with a release manifest in release management\n\nRelease management\n------\n\n`deploy_stack.py` can read a release manifest file if you specify it in the `-m` commandline argument. Release manifest contains images, their versions and other information about the software that is being deployed by the Seed. You can then inform your Cloudformation stacks about the versions and images you are deploying using the `!ArtifactVersion`, `!ArtifactRepo` and `!ArtifactImage` tags in the runtime environment configuration.\n\nMore documentation about release management is coming soon.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Innablr/cloudformation-seed", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cloudformation-seed", "package_url": "https://pypi.org/project/cloudformation-seed/", "platform": "", "project_url": "https://pypi.org/project/cloudformation-seed/", "project_urls": { "Homepage": "https://github.com/Innablr/cloudformation-seed" }, "release_url": "https://pypi.org/project/cloudformation-seed/0.10.0/", "requires_dist": [ "boto3 (>=1.9.64)", "PyYAML (>=5.1)", "colorama (>=0.4.1)" ], "requires_python": "", "summary": "Orchestrates large Cloudformation deployments", "version": "0.10.0" }, "last_serial": 5722516, "releases": { "0.10.0": [ { "comment_text": "", "digests": { "md5": "6844a78db0c2cea821fe5eb22bff5311", "sha256": "d4125383ca1b13f76843644d86318219cfde2389be0a7e1bb65ed27ff9d34498" }, "downloads": -1, "filename": "cloudformation_seed-0.10.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6844a78db0c2cea821fe5eb22bff5311", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24651, "upload_time": "2019-08-23T19:54:53", "url": "https://files.pythonhosted.org/packages/49/91/6c6f9140965da86a937703feff6104e928a9426888bab9730404e4bf0064/cloudformation_seed-0.10.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "90a91da12eeb12a8ff46415bde88dbff", "sha256": "cbf4b9cd308aac169d01825b7d240e83d1df670ec38ffd863e5d16e7dcf532e4" }, "downloads": -1, "filename": "cloudformation-seed-0.10.0.tar.gz", "has_sig": false, "md5_digest": "90a91da12eeb12a8ff46415bde88dbff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24821, "upload_time": "2019-08-23T19:54:55", "url": "https://files.pythonhosted.org/packages/2f/1a/b3c0271b95cfdbcc3feace7d26660199fcffc99e47a20b0d93fc3a2d1aad/cloudformation-seed-0.10.0.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "46831f782a0f3a71465df27880812ee3", "sha256": "742a19467f2e6414c60c0a2d678506b2ebbcd410cd671d5cb729e1ea6111d830" }, "downloads": -1, "filename": "cloudformation_seed-0.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "46831f782a0f3a71465df27880812ee3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19220, "upload_time": "2019-03-12T08:21:13", "url": "https://files.pythonhosted.org/packages/2c/46/7dcd15ebc95ad472c86ead9d87becae8738d8d091e9d5484b184cdb38398/cloudformation_seed-0.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b8830812c7b1e0190e3b23678bf38641", "sha256": "4fa91391b374e01591c5b65ec48e8fe799c8553c2c7125175e7f8e842b11347b" }, "downloads": -1, "filename": "cloudformation-seed-0.9.0.tar.gz", "has_sig": false, "md5_digest": "b8830812c7b1e0190e3b23678bf38641", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19151, "upload_time": "2019-03-12T08:21:16", "url": "https://files.pythonhosted.org/packages/53/06/c5982055047e1e31877b1c984245030b69446c2039d3cc5befd8c9ac3ae1/cloudformation-seed-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "9790d75f3b7e2f56121972e4cb2faa9b", "sha256": "2d52caeaf2d26e4a8f46f24db90b90c0e7d6c86e11769a847f38533052d0f1e6" }, "downloads": -1, "filename": "cloudformation_seed-0.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9790d75f3b7e2f56121972e4cb2faa9b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19130, "upload_time": "2019-03-18T05:50:29", "url": "https://files.pythonhosted.org/packages/56/60/0d55aaaea6c28ca153556eafeed40d0e55f039311e7df67b48744ef13829/cloudformation_seed-0.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64fb0959baa7967f48879d0fa503e207", "sha256": "e8059c4b5b887e6458ff3114cde2fd3e09fb1440336e75d46577463e9bd48d10" }, "downloads": -1, "filename": "cloudformation-seed-0.9.1.tar.gz", "has_sig": false, "md5_digest": "64fb0959baa7967f48879d0fa503e207", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19879, "upload_time": "2019-03-18T05:50:31", "url": "https://files.pythonhosted.org/packages/7c/79/52fc2bbf5dfa13d0dac93c27577f8c4946ccadd3e330372f5ce7de78127a/cloudformation-seed-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "967aaa0d2bc9694437e79565c3227c8b", "sha256": "3cc0146015c362ff7e7277c7c1cc6481fd5fb28d21634dc85b1365c2eed412df" }, "downloads": -1, "filename": "cloudformation_seed-0.9.2-py3-none-any.whl", "has_sig": false, "md5_digest": "967aaa0d2bc9694437e79565c3227c8b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19140, "upload_time": "2019-03-21T00:31:58", "url": "https://files.pythonhosted.org/packages/c9/af/aeed124901bb86c4bab944f4cad74d351b8a1bf537f778f23f4379e89988/cloudformation_seed-0.9.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc9a9d1dfa416a8c4cb57ab422ba86b9", "sha256": "4859d735a1e157eb101ff15bedd88752df64ae7124f3969848ba61c6aa7d76e9" }, "downloads": -1, "filename": "cloudformation-seed-0.9.2.tar.gz", "has_sig": false, "md5_digest": "dc9a9d1dfa416a8c4cb57ab422ba86b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19892, "upload_time": "2019-03-21T00:32:00", "url": "https://files.pythonhosted.org/packages/79/7e/39b32589c0ad8cf0457b42f078498aee4feb5671adf9a0db8063753c90a3/cloudformation-seed-0.9.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6844a78db0c2cea821fe5eb22bff5311", "sha256": "d4125383ca1b13f76843644d86318219cfde2389be0a7e1bb65ed27ff9d34498" }, "downloads": -1, "filename": "cloudformation_seed-0.10.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6844a78db0c2cea821fe5eb22bff5311", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24651, "upload_time": "2019-08-23T19:54:53", "url": "https://files.pythonhosted.org/packages/49/91/6c6f9140965da86a937703feff6104e928a9426888bab9730404e4bf0064/cloudformation_seed-0.10.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "90a91da12eeb12a8ff46415bde88dbff", "sha256": "cbf4b9cd308aac169d01825b7d240e83d1df670ec38ffd863e5d16e7dcf532e4" }, "downloads": -1, "filename": "cloudformation-seed-0.10.0.tar.gz", "has_sig": false, "md5_digest": "90a91da12eeb12a8ff46415bde88dbff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24821, "upload_time": "2019-08-23T19:54:55", "url": "https://files.pythonhosted.org/packages/2f/1a/b3c0271b95cfdbcc3feace7d26660199fcffc99e47a20b0d93fc3a2d1aad/cloudformation-seed-0.10.0.tar.gz" } ] }