{"id":13572319,"url":"https://github.com/cloudtools/troposphere","last_synced_at":"2026-02-13T00:55:59.276Z","repository":{"id":5918307,"uuid":"7137821","full_name":"cloudtools/troposphere","owner":"cloudtools","description":"troposphere - Python library to create AWS CloudFormation descriptions","archived":false,"fork":false,"pushed_at":"2025-05-04T00:57:36.000Z","size":6509,"stargazers_count":4947,"open_issues_count":165,"forks_count":1432,"subscribers_count":164,"default_branch":"main","last_synced_at":"2025-05-09T02:47:39.721Z","etag":null,"topics":["aws-cloudformation","cloudformation","python","python3","troposphere"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudtools.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.rst","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-12-12T21:19:46.000Z","updated_at":"2025-05-04T02:14:19.000Z","dependencies_parsed_at":"2023-10-24T20:29:33.621Z","dependency_job_id":"87c98339-c397-4374-b0eb-a4b781dc63dd","html_url":"https://github.com/cloudtools/troposphere","commit_stats":{"total_commits":2918,"total_committers":518,"mean_commits":5.633204633204633,"dds":0.4763536668951337,"last_synced_commit":"8e1cf6d9e2cbe20352aa09041be0ba29e7ebabe4"},"previous_names":[],"tags_count":106,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudtools%2Ftroposphere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudtools%2Ftroposphere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudtools%2Ftroposphere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudtools%2Ftroposphere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudtools","download_url":"https://codeload.github.com/cloudtools/troposphere/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253509589,"owners_count":21919582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-cloudformation","cloudformation","python","python3","troposphere"],"created_at":"2024-08-01T14:01:19.986Z","updated_at":"2026-02-13T00:55:59.218Z","avatar_url":"https://github.com/cloudtools.png","language":"Python","readme":"===========\ntroposphere\n===========\n\n.. image:: https://img.shields.io/pypi/v/troposphere.svg\n    :target: https://pypi.python.org/pypi/troposphere\n    :alt: PyPI Version\n\n.. image:: https://github.com/cloudtools/troposphere/actions/workflows/tests.yml/badge.svg\n    :target: https://github.com/cloudtools/troposphere/actions?query=branch%3Amain\n    :alt: Build Status\n\n.. image:: https://img.shields.io/pypi/l/troposphere.svg\n    :target: https://opensource.org/licenses/BSD-2-Clause\n    :alt: license: New BSD license\n\n.. image:: https://readthedocs.org/projects/troposphere/badge/?version=latest\n    :target: https://troposphere.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\nAbout\n=====\n\ntroposphere - library to create `AWS CloudFormation`_ descriptions\n\nThe troposphere library allows for easier creation of the `AWS CloudFormation\nJSON`_ by writing Python code to describe the AWS resources. troposphere also\nincludes some basic support for `OpenStack resources`_ via Heat.\n\nTo facilitate catching CloudFormation or JSON errors early the library has\nproperty and type checking built into the classes.\n\nInstallation\n============\n\ntroposphere can be installed using the pip distribution system for Python by\nissuing:\n\n.. code:: sh\n\n    $ pip install troposphere\n\nTo install troposphere with `awacs \u003chttps://github.com/cloudtools/awacs\u003e`_\n(recommended soft dependency):\n\n.. code:: sh\n\n    $ pip install troposphere[policy]\n\nAlternatively, you can use `setup.py` to install by cloning this repository\nand issuing:\n\n.. code:: sh\n\n    $ python setup.py install  # you may need sudo depending on your python installation\n\nExamples\n========\n\nA simple example to create an instance would look like this:\n\n.. code:: python\n\n    \u003e\u003e\u003e from troposphere import Ref, Template\n    \u003e\u003e\u003e import troposphere.ec2 as ec2\n    \u003e\u003e\u003e t = Template()\n    \u003e\u003e\u003e instance = ec2.Instance(\"myinstance\")\n    \u003e\u003e\u003e instance.ImageId = \"ami-951945d0\"\n    \u003e\u003e\u003e instance.InstanceType = \"t1.micro\"\n    \u003e\u003e\u003e t.add_resource(instance)\n    \u003ctroposphere.ec2.Instance object at 0x101bf3390\u003e\n    \u003e\u003e\u003e print(t.to_json())\n    {\n        \"Resources\": {\n            \"myinstance\": {\n                \"Properties\": {\n                    \"ImageId\": \"ami-951945d0\",\n                    \"InstanceType\": \"t1.micro\"\n                },\n                \"Type\": \"AWS::EC2::Instance\"\n            }\n        }\n    }\n    \u003e\u003e\u003e print(t.to_yaml())\n    Resources:\n        myinstance:\n            Properties:\n                ImageId: ami-951945d0\n                InstanceType: t1.micro\n            Type: AWS::EC2::Instance\n\nAlternatively, parameters can be used instead of properties:\n\n.. code:: python\n\n    \u003e\u003e\u003e instance = ec2.Instance(\"myinstance\", ImageId=\"ami-951945d0\", InstanceType=\"t1.micro\")\n    \u003e\u003e\u003e t.add_resource(instance)\n    \u003ctroposphere.ec2.Instance object at 0x101bf3550\u003e\n\nAnd ``add_resource()`` returns the object to make it easy to use with ``Ref()``:\n\n.. code:: python\n\n    \u003e\u003e\u003e instance = t.add_resource(ec2.Instance(\"myinstance\", ImageId=\"ami-951945d0\", InstanceType=\"t1.micro\"))\n    \u003e\u003e\u003e Ref(instance)\n    \u003ctroposphere.Ref object at 0x101bf3490\u003e\n\n---------------------------------------------------------------------\nExamples of the error checking (full tracebacks removed for clarity):\n---------------------------------------------------------------------\n\nIncorrect property being set on AWS resource:\n\n.. code:: python\n\n    \u003e\u003e\u003e import troposphere.ec2 as ec2\n    \u003e\u003e\u003e ec2.Instance(\"ec2instance\", image=\"i-XXXX\")\n    Traceback (most recent call last):\n    ...\n    AttributeError: AWS::EC2::Instance object does not support attribute image\n\nIncorrect type for AWS resource property:\n\n.. code:: python\n\n    \u003e\u003e\u003e ec2.Instance(\"ec2instance\", ImageId=1)\n    Traceback (most recent call last):\n    ...\n    TypeError: ImageId is \u003ctype 'int'\u003e, expected \u003ctype 'basestring'\u003e\n\nMissing required property for the AWS resource:\n\n.. code:: python\n\n    \u003e\u003e\u003e from troposphere import Template\n    \u003e\u003e\u003e import troposphere.ec2 as ec2\n    \u003e\u003e\u003e t = Template()\n    \u003e\u003e\u003e t.add_resource(ec2.Subnet(\"ec2subnet\", VpcId=\"vpcid\"))\n    \u003ctroposphere.ec2.Subnet object at 0x100830ed0\u003e\n    \u003e\u003e\u003e print(t.to_json())\n    Traceback (most recent call last):\n    ...\n    ValueError: Resource CidrBlock required in type AWS::EC2::Subnet (title: ec2subnet)\n\nCurrently supported resource types\n======================================\n\n- `AWS Resource Types`_\n- `OpenStack Resource Types`_\n\nDuplicating a single instance sample would look like this\n=========================================================\n\n.. code:: python\n\n    # Converted from EC2InstanceSample.template located at:\n    # http://aws.amazon.com/cloudformation/aws-cloudformation-templates/\n\n    from troposphere import Base64, FindInMap, GetAtt\n    from troposphere import Parameter, Output, Ref, Template\n    import troposphere.ec2 as ec2\n\n\n    template = Template()\n\n    keyname_param = template.add_parameter(Parameter(\n        \"KeyName\",\n        Description=\"Name of an existing EC2 KeyPair to enable SSH \"\n                    \"access to the instance\",\n        Type=\"String\",\n    ))\n\n    template.add_mapping('RegionMap', {\n        \"us-east-1\":      {\"AMI\": \"ami-7f418316\"},\n        \"us-west-1\":      {\"AMI\": \"ami-951945d0\"},\n        \"us-west-2\":      {\"AMI\": \"ami-16fd7026\"},\n        \"eu-west-1\":      {\"AMI\": \"ami-24506250\"},\n        \"sa-east-1\":      {\"AMI\": \"ami-3e3be423\"},\n        \"ap-southeast-1\": {\"AMI\": \"ami-74dda626\"},\n        \"ap-northeast-1\": {\"AMI\": \"ami-dcfa4edd\"}\n    })\n\n    ec2_instance = template.add_resource(ec2.Instance(\n        \"Ec2Instance\",\n        ImageId=FindInMap(\"RegionMap\", Ref(\"AWS::Region\"), \"AMI\"),\n        InstanceType=\"t1.micro\",\n        KeyName=Ref(keyname_param),\n        SecurityGroups=[\"default\"],\n        UserData=Base64(\"80\")\n    ))\n\n    template.add_output([\n        Output(\n            \"InstanceId\",\n            Description=\"InstanceId of the newly created EC2 instance\",\n            Value=Ref(ec2_instance),\n        ),\n        Output(\n            \"AZ\",\n            Description=\"Availability Zone of the newly created EC2 instance\",\n            Value=GetAtt(ec2_instance, \"AvailabilityZone\"),\n        ),\n        Output(\n            \"PublicIP\",\n            Description=\"Public IP address of the newly created EC2 instance\",\n            Value=GetAtt(ec2_instance, \"PublicIp\"),\n        ),\n        Output(\n            \"PrivateIP\",\n            Description=\"Private IP address of the newly created EC2 instance\",\n            Value=GetAtt(ec2_instance, \"PrivateIp\"),\n        ),\n        Output(\n            \"PublicDNS\",\n            Description=\"Public DNSName of the newly created EC2 instance\",\n            Value=GetAtt(ec2_instance, \"PublicDnsName\"),\n        ),\n        Output(\n            \"PrivateDNS\",\n            Description=\"Private DNSName of the newly created EC2 instance\",\n            Value=GetAtt(ec2_instance, \"PrivateDnsName\"),\n        ),\n    ])\n\n    print(template.to_json())\n\nCommunity\n=========\n\nWe have a Google Group, cloudtools-dev_, where you can ask questions and\nengage with the troposphere community. Issues and pull requests are always\nwelcome!\n\nLicensing\n=========\n\ntroposphere is licensed under the `BSD 2-Clause license`_.\nSee `LICENSE`_ for the troposphere full license text.\n\n\n.. _`AWS CloudFormation`: http://aws.amazon.com/cloudformation\n.. _`AWS CloudFormation JSON`: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html\n.. _`OpenStack resources`: http://docs.openstack.org/developer/heat/template_guide/openstack.html\n.. _cloudtools-dev: https://groups.google.com/forum/#!forum/cloudtools-dev\n.. _`LICENSE`: https://github.com/cloudtools/troposphere/blob/master/LICENSE\n.. _`BSD 2-Clause license`: http://opensource.org/licenses/BSD-2-Clause\n.. _`AWS Resource Types`: https://github.com/cloudtools/troposphere/blob/master/resources_aws.md\n.. _`OpenStack Resource Types`: https://github.com/cloudtools/troposphere/blob/master/resources_openstack.md\n","funding_links":[],"categories":["Python","Open Source Repos","DSLs and Generators","Code Generation"],"sub_categories":["CloudFormation","Hooks"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudtools%2Ftroposphere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudtools%2Ftroposphere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudtools%2Ftroposphere/lists"}