Example #1
0
    	zones[zone_id - 1].append('range=' + str(octet))
    return zones


cmd = commander.commands()
attribs = cmd.stack_cmd()
network_zones = attribs.network_zones
availability_zones =  attribs.availability_zones
company_name = attribs.company_name
project_name = attribs.project_name
vpc_cidr = attribs.vpc_cidr
region_name = attribs.region_name
stack_name = attribs.stack_name


awscmd = commander.aws(region_name)

net = IPNetwork(vpc_cidr)
subnets = list(net.subnet(26))

zones = list(item.split(",") for item in network_zones)
aws_cmd = cloudformer.aws_resources()


VPC = aws_cmd.create_vpc(project_name, company_name, project_name, vpc_cidr)
IGW = aws_cmd.create_internet_gateway(company_name, project_name, 'InternetGateway')
IGWATT = aws_cmd.create_gateway_attachment(project_name, 'InternetGateway')

zone_list = set_octet(zones)
for record in range(0, len(zones)):
    name = zone_list[record][0].split("=")[1]
Example #2
0
#!/bin/python
import commander
import cloudformer
from netaddr import IPNetwork
import boto.cloudformation
import time

cmd = commander.commands()
attribs = cmd.security_cmd()

sg_names =  attribs.component_security_groups
vpc_id = attribs.vpc_id
rule_list = attribs.rule_list


awscmd = commander.aws('eu-west-1')

aws_cmd = cloudformer.aws_resources()

for name in sg_names:
    aws_cmd.create_sg(name, vpc_id, 'Some Descriptions about the ' + name)
    
for line in rule_list:
    rule = line.split(":")
    print("Source: {} Dest: {}".format(rule[1], rule[2]))
    aws_cmd.create_sg_ingress(rule[0], rule[3], rule[4], rule[1], rule[5])

cfn_body = aws_cmd.complete_cfn()
print cfn_body
# awscmd.create_stack('test-poc-security', cfn_body)