Skip to main content

Easy and powerful stack templates for AWS CloudFormation

Project description

CloudCast - Easy and powerful stack templates for AWS CloudFormation

What is it?

AWS CloudFormation is pretty powerful, but once your stacks are getting
sophisticated, it can be hard to work with. You may easily get
lost in a sea of maps and lists, and it can be hard to keep track of
references across your resources.

Also, this may be my personal pet peeve, but JSON has no syntax for comments!
This makes templates written for CFN hard to document and maintain.

With CloudCast you can easily create any template you would write for CFN, but
using plain Python syntax.

Resources, Mappings, Parameters and Outputs are defined as Python objects. It
looks cleaner and you can do smarter stuff with them!

For instance:

from cloudcast.template import Resource

LoadBalancer = Resource(
AvailabilityZones=[ 'us-east-1c', 'us-east-1d' ],
"HealthyThreshold" : "2",
"Interval" : "30",
"Target" : "HTTP:80/status",
"Timeout" : "5",
"UnhealthyThreshold" : "3"
"InstancePort" : "80",
"InstanceProtocol" : 'HTTP',
"LoadBalancerPort" : "80",
"Protocol" : 'HTTP',

If you are familiar with AWS and CFN, this structure shouldn't be strange to you.
We have just declared an ELB resource with some properties.

Later on, the load balancer may be referenced from a security group, in order to
be allowed to access the service ports in the balanced instances:

AppSG = Resource(
GroupDescription = "Allow access app from LB only",
SecurityGroupIngress = [ {
"IpProtocol" : "tcp",
"FromPort" : 80,
"ToPort" : 80,
"SourceSecurityGroupOwnerId" : LoadBalancer['SourceSecurityGroup.OwnerAlias'],
"SourceSecurityGroupName": LoadBalancer['SourceSecurityGroup.GroupName'],

Since you are dealing with Python objects, nothing is stopping you from
bundling them in your own libraries and reusing them as necessary. We have
an example of that around here (look at the cloudcast.library.stack_user module).

In fact, you can create any Python code that may help you making your
templates simpler and more expressive!

How do you get the JSON templates?

Once you've got your template python file (let's call it, you would:

from cloudcast import Stack
stack = Stack(
description = "Sample stack that doesn't do much",
env = { ... define environment vars here ... },
resources_file = ""
print stack.dump_json()

The following will happen:

1. The Stack class will load, examine your code module and find
the relevant objects to be included in the CloudFormation template (resources,
outputs, parameters..). It shouldn't get confused with any other code you
may have there.
2. The template will be printed out for you to feed into CloudFormation.

Deploying software on the instances

Cloudcast helps you embed your instance software configuration into your
CloudFormation templates. In order to do that, it allows you to leverage
some technologies that are usually applied for this purpose:

- [cfn-init](
- shell scripts
- [ansible](

The support for this is fairly extensible, so it wouldn't be too far fetched to add support for other SCMs like Chef or Puppet.

Special thanks

[Bright & Shiny]( - their support and fine
understanding of well managed infrastructure, made it possible for me to
devote the necessary efforts to evolve this concept.

If you are looking for an awesome software agency make sure to check their

[Lifestreams Technology]( - developing for their
products has proved to be an excellent ground to develop and put into
practice new ideas such as the one that originated this project. Thanks
for the chance to bring CloudCast to the point where it is a key technology
to support mission-critical operations.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudcast-0.1.2.tar.gz (23.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page