Skip to content

graze/tropopause

Repository files navigation

tropopause - a troposphere wrapper

Software License Build Status

About

tropopause - a wrapper for troposphere to create Cloudformation templates and abstracts away boilerplate.

The tropopause library extends troposphere by adding composite objects that create the Cloudformation objects required to support specific tasks. Tags are inherited and applied to all taggable objects.

Installation

This library has been developed and tested against Python 3.4-3.6.

tropopause can be installed using the pip distribution system for Python by issuing:

$ pip install graze-tropopause

Alternatively, you can run use setup.py to install by cloning this repository and issuing:

$ python setup.py install # you may need sudo depending on your python installation

Development

For development, consult CONTRIBUTING.md:

Usage

tropopause usage is similar to that of troposphere, the principle difference is that the composite objects always expect the template object to be passed in as the second parameter.

>>> from troposphere import Template
>>> from tropopause.ec2 import InternetGatewayVPC
>>> t = Template()
>>> vpc = InternetGatewayVPC("example", t, CidrBlock="10.0.0.0/24")
>>> print(t.to_json())
{
    "Resources": {
        "example": {
            "Properties": {
                "CidrBlock": "10.0.0.0/24"
            },
            "Type": "AWS::EC2::VPC"
        },
        "internetgateway": {
            "Type": "AWS::EC2::InternetGateway"
        },
        "vpcgatewayattachment": {
            "Properties": {
                "InternetGatewayId": {
                    "Ref": "internetgateway"
                },
                "VpcId": {
                    "Ref": "example"
                }
            },
            "Type": "AWS::EC2::VPCGatewayAttachment"
        }
    }
}

Available Objects

tropopause

  • Tags - A replacement for troposphere Tags, concatenating tags deduplicates Keys, with precendence to the rightmost expression.
>>> from tropopause import Tags
>>> print((Tags(a='left') + Tags(a='right')).tags)
[{'Value': 'right', 'Key': 'a'}]

tropopause.autoscaling

  • AutoScalingGroup - Creates an AutoScalingGroup, inherits all Tags from Subnets launched into and ensures all Tags have propogate at launch set to True
  • LaunchConfigurationRPM - Bootstraps RPM based systems to run cfn-init and notify the AutoScalingGroup once the init process completes with cfn-signal

tropopause.cloudformation

  • InitConfigFromHTTP - Ensures cfn-hup is installed and running, and then executes a shell script from a HTTP(S) endpoint
  • InitConfigFromS3 - Ensures cfn-hup is installed and running, and then executes a shell script from a S3 bucket

tropopause.ec2

  • InternetGatewayVPC - Creates a VPC, an InternetGateway and the required VPCGatewayAttachment
  • PublicSubnet - Creates a Subnet, EIP and a NatGateway. Connects everything together and routes all traffic via an existing InternetGateway
  • PrivateSubnet - Creates a Subnet, attempts to find a Public Subnet in the same Availability Zone and then routes all traffic via an existing NatGateway
  • SecureSubnet - Creates a Subnet, does not route traffic to the Internet
  • RoutedVPCPeeringConnection - Creates a peering request with another VPC and all local routing
  • SecurityGroupFromYaml - Creates a Security Group from a YAML configuration file

tropopause.elasticloadbalancingv2

  • SecureLoadBalancerWithListener - Creates an Application Load Balancer and attaches a Listener with a dummy Target Group. TLS is assumed

tropopause.iam

  • RoleFromYaml - Creates an IAM Role from a YAML file
  • PolicyFromYaml - Creates an IAM Policy from a YAML file
  • PolicyTypeYaml - Creates an IAM PolicyType from a YAML file

Licensing

tropopause is licensed under the MIT license. See LICENSE.md for the tropopause full license text.

About

☁️ a thin layer over troposphere to simplify boilerplate code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published