View on GitHub

Automation for AWS VPC management, built on top of boto.

At its core, veep contains a set of objects subclassing familiar boto objects, adding convenience methods. It also contains a set of helper functions written to make common AWS operations more convenient. Most of the library is built around managing multiple VPCs across multiple regions as painless as possible, reducing the opportunity for config drift across vpcs and regions. Inside VPC you will find a hierarchy of objects and associated methods:

Here's a quick introduction to using veep to build a VPC, containing a single 'frontend' tier across us-west-2's availability zones.

# Create a new 'prod' environment VPC in us-west-2
region = veep.VPC.Region('us-west-2')
vpc = region.create_vpc(env='prod', cidr_block='10.0.0.0/16')

# Add a tier allocated from the first /18 of the VPC's ip space.
# Subnets in the tier will be consecutive /22 blocks from that /18.
tier = vpc.add_tier('frontend', list(vpc.get_cidr().subnet(18))[0], subnet_size=22)

# create_vpc() initalized a route table
table = vpc.get_tables(name='Public')

# Associate route table with Tier subnets
tier.associate_table(table)

# Et voila, you have a subnet for each AZ, associated with your route table:
>>> for s in tier.subnets:
...     print s.tags.get('Name'), s.cidr_block
... 
frontend-us-west-2b 10.0.4.0/22
frontend-us-west-2c 10.0.8.0/22
frontend-us-west-2a 10.0.0.0/22