{ "info": { "author": "tie", "author_email": "tropostack@morp.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "tropostack\n==========\n\n[![Latest PyPI version](https://img.shields.io/pypi/v/tropostack.svg)](https://pypi.python.org/pypi/tropostack)\n[![Build Status](https://travis-ci.org/gtie/tropostack.svg?branch=master)](https://travis-ci.org/gtie/tropostack)\n\nWrapper around the excellent Troposphere library for easy creation and management of CloudFormation stacks.\n\nGetting Started\n-----\n\nYou use `tropostack` as a library to:\n - Consisteny define CloudFormation templates in Python code\n - Have a CLI around each stack definition, enabling it to live as a standalone executable\n \nHere is a minimalistic example of a stack that creates a DynamoDB table with a single key:\n\n```\n#!/usr/bin/env python3\nfrom troposphere import Output, Export, Ref, Sub, GetAtt\nfrom troposphere import dynamodb\n\nfrom tropostack.base import EnvStack\nfrom tropostack.cli import EnvCLI\n\nclass DynamoDbStack(EnvStack):\n BASE_NAME = 'example-dynamodb'\n\n @property\n def o_dynamodb_table_name(self):\n _id = 'TableName'\n return Output(\n _id,\n Description='The name of the DynamoDB table',\n Value=self.r_table.ref(),\n Export=Export(Sub(\"${AWS::StackName}-%s\" % _id))\n )\n\n @property\n def o_dynamodb_table_arn(self):\n _id = 'TableArn'\n return Output(\n _id,\n Description='The ARN identifier of the DynamoDB table',\n Value=GetAtt(self.r_table, 'Arn'),\n Export=Export(Sub(\"${AWS::StackName}-%s\" % _id))\n )\n\n @property\n def r_table(self):\n table_name = self.conf['table_name']\n table_key = self.conf['table_key']\n return dynamodb.Table(\n 'DynamoDbTable',\n TableName=table_name,\n BillingMode='PAY_PER_REQUEST',\n AttributeDefinitions=[\n dynamodb.AttributeDefinition(\n AttributeName=table_key,\n AttributeType='S'\n ),\n ],\n KeySchema=[\n dynamodb.KeySchema(\n AttributeName=table_key,\n KeyType='HASH'\n )\n ]\n )\n\nif __name__ == '__main__':\n cli = EnvCLI(DynamoDbStack)\n```\n\nThe above already gives you a CLI around your stack definition.\nAssuming you put it inside an executable file called `my_dynamodb.py`, you'd be able to call it already:\n```\n$ ./my_dynamodb.py -h\nusage: my_dynamodb.py [-h]\n conf_file\n {apply,create,delete,generate,outputs,update,validate}\n\npositional arguments:\n conf_file\n {apply,create,delete,generate,outputs,update,validate}\n\noptional arguments:\n -h, --help show this help message and exit\n\n```\n\nTo enable the stack definition to be reused across multiple environments (e.g. def, test, production) with differing details,\na configuration file is required (by default). A simple configuration file for the above stack would look like:\n```\nenv: dev\nregion: eu-west-1\n\nexample-dynamodb:\n table_name: my-test-table\n table_key: my-id\n```\n\nNow we can fire up the CloudFormation stack that would create our DynamoDB table:\n```\n$ ./dynamodb_table.py config.yaml apply\nStack creation initiated for: arn:aws:cloudformation:eu-west-1:472799024263:stack/example-dynamodb-dev/2e0f8430-e2a9-11e9-bd25-0aac5439e4be\nTIMESTAMP (UTC) RESOURCE TYPE RESOURCE ID STATUS REASON\n2019-09-29 11:06:26 AWS::CloudFormation::Stack example-dynamodb-dev CREATE_IN_PROGRESS User Initiated\n2019-09-29 11:06:28 AWS::DynamoDB::Table DynamoDbTable CREATE_IN_PROGRESS \n2019-09-29 11:06:28 AWS::DynamoDB::Table DynamoDbTable CREATE_IN_PROGRESS Resource creation Initiated\n2019-09-29 11:06:59 AWS::DynamoDB::Table DynamoDbTable CREATE_COMPLETE \n2019-09-29 11:07:00 AWS::CloudFormation::Stack example-dynamodb-dev CREATE_COMPLETE \n```\n\n(the `apply` subcommand above is equivalent to _create or update_)\n\nStock commands\n------------\nWhile the CLI can be expanded for particular stacks, there are several subcommands that come out of the box:\n - `generate` - prints the resulting CloudFormation YAML to the screen \n - `validate` - Sends the CloudFormation template to the AWS API for validation, and reports back result\n - `create` - Initiates the stack creation (should only be used if the stack does not exist yet)\n - `update` - Updates an existing stack (should only be used if the stack exists)\n - `apply` - Idempotently updates or creates a stack, based on whether it exists or not\n - `outputs` - Shows the outputs of an existing stack\n - `delete` - Deletes an existing stack\n\n\nInstallation\n------------\n`pip install tropostack`\n\n\nCompatibility\n-------------\n\nLicence\n-------\nSee LICENSE file.\n\nAuthors\n-------\n`tropostack` was written by `tie `.", "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/topostack/tropostack", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tropostack", "package_url": "https://pypi.org/project/tropostack/", "platform": "", "project_url": "https://pypi.org/project/tropostack/", "project_urls": { "Homepage": "https://github.com/topostack/tropostack" }, "release_url": "https://pypi.org/project/tropostack/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "Wrapper around the Troposphere lib for CLI management of CloudFormation stacks", "version": "0.2.0" }, "last_serial": 6001094, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6d0141a8d90b933e15347a249f5bea06", "sha256": "321c2c35b9218167d1576d935102d9419575bc59f91eca780305cbd19f48d735" }, "downloads": -1, "filename": "tropostack-0.1.0-py3.7.egg", "has_sig": false, "md5_digest": "6d0141a8d90b933e15347a249f5bea06", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 14709, "upload_time": "2019-09-29T11:20:15", "url": "https://files.pythonhosted.org/packages/06/c8/03ac798b9f0bfbab595040d93b4ec6f0f8fd65ad53d53ac2e9717204fe8d/tropostack-0.1.0-py3.7.egg" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "687539d1518692aafd8ba696497b39a6", "sha256": "f0cb66075d740e7f90a7496cd7f771afef5c645d11a01326e76ee61ac3384b51" }, "downloads": -1, "filename": "tropostack-0.1.1.tar.gz", "has_sig": false, "md5_digest": "687539d1518692aafd8ba696497b39a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8314, "upload_time": "2019-09-29T11:25:35", "url": "https://files.pythonhosted.org/packages/a4/13/b5a5ae83086935fd99d6110c2a009c12dc9cebd5235ac835c6f898ca93a1/tropostack-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "e9022b8cf55aa07ef5d3cb29fa18071c", "sha256": "2381f6587794e8aad6daf539f969187cd577a09d900b369d53c8f77eb423980e" }, "downloads": -1, "filename": "tropostack-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e9022b8cf55aa07ef5d3cb29fa18071c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8406, "upload_time": "2019-09-29T19:53:20", "url": "https://files.pythonhosted.org/packages/9f/40/67837a0a68e9543b30fbe5b451169be3da804b2915376d5ea01b7c757423/tropostack-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "8fcfc365b7883ad268c73de464807b9b", "sha256": "7135c7c9edb6991f05a6d5551ab70d5e4076c2c9a0d65cf037462a4718268e75" }, "downloads": -1, "filename": "tropostack-0.1.3.tar.gz", "has_sig": false, "md5_digest": "8fcfc365b7883ad268c73de464807b9b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8408, "upload_time": "2019-09-29T19:58:19", "url": "https://files.pythonhosted.org/packages/e9/4a/9224a2e9f183ecebf586c3f07bf55e7d9241cc09f5705fe160eeba891a05/tropostack-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ea5ddd4755b2531e79209d4430241f63", "sha256": "a55debba072ceae9d961ccd5f5402a32ffa529ffad03fb9e4b4fc3e170b94588" }, "downloads": -1, "filename": "tropostack-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ea5ddd4755b2531e79209d4430241f63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8663, "upload_time": "2019-10-19T21:40:13", "url": "https://files.pythonhosted.org/packages/de/06/f2d0a25916618a645d88ec3c0faf578ce00a67237052dbca366bc7e1e680/tropostack-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ea5ddd4755b2531e79209d4430241f63", "sha256": "a55debba072ceae9d961ccd5f5402a32ffa529ffad03fb9e4b4fc3e170b94588" }, "downloads": -1, "filename": "tropostack-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ea5ddd4755b2531e79209d4430241f63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8663, "upload_time": "2019-10-19T21:40:13", "url": "https://files.pythonhosted.org/packages/de/06/f2d0a25916618a645d88ec3c0faf578ce00a67237052dbca366bc7e1e680/tropostack-0.2.0.tar.gz" } ] }