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.
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
For development, consult CONTRIBUTING.md:
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"
}
}
}
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'}]
AutoScalingGroup
- Creates an AutoScalingGroup, inherits all Tags from Subnets launched into and ensures all Tags have propogate at launch set to TrueLaunchConfigurationRPM
- Bootstraps RPM based systems to run cfn-init and notify the AutoScalingGroup once the init process completes with cfn-signal
InitConfigFromHTTP
- Ensures cfn-hup is installed and running, and then executes a shell script from a HTTP(S) endpointInitConfigFromS3
- Ensures cfn-hup is installed and running, and then executes a shell script from a S3 bucket
InternetGatewayVPC
- Creates a VPC, an InternetGateway and the required VPCGatewayAttachmentPublicSubnet
- Creates a Subnet, EIP and a NatGateway. Connects everything together and routes all traffic via an existing InternetGatewayPrivateSubnet
- Creates a Subnet, attempts to find a Public Subnet in the same Availability Zone and then routes all traffic via an existing NatGatewaySecureSubnet
- Creates a Subnet, does not route traffic to the InternetRoutedVPCPeeringConnection
- Creates a peering request with another VPC and all local routingSecurityGroupFromYaml
- Creates a Security Group from a YAML configuration file
SecureLoadBalancerWithListener
- Creates an Application Load Balancer and attaches a Listener with a dummy Target Group. TLS is assumed
RoleFromYaml
- Creates an IAM Role from a YAML filePolicyFromYaml
- Creates an IAM Policy from a YAML filePolicyTypeYaml
- Creates an IAM PolicyType from a YAML file
tropopause is licensed under the MIT license. See LICENSE.md for the tropopause full license text.