def make_recipe(settings):
    # Load the recipe
    recipe_name = settings['recipe_name']
    if not os.path.exists('recipes/%s.yml' % recipe_name):
        raise Exception('Recipe %s not found' % recipe_name)
    recipe = yaml.load(open('recipes/%s.yml' % recipe_name))
    
    # Push everything up to S3
    push_assets(settings)
    
    print 'Connecting to EC2...'
    # Set the region
    ec2_region = boto.ec2.get_region(
        settings['region'],
        aws_access_key_id=settings['access_key'],
        aws_secret_access_key=settings['secret_key']
    )
    # Make the connection
    ec2_connection = boto.connect_ec2(
        settings['access_key'],
        settings['secret_key'],
        region=ec2_region,
    )
    
    # See how many servers we need for this recipe
    if type(recipe['server']) == type(list()):
        servers = recipe['server']
    else:
        servers = [recipe['server'],]

    # Setup template directory
    env = Environment(loader=FileSystemLoader(settings['templates_dir']))

    reservations = list()
    for server in servers:
        settings['server'] = server

        # Generating bootscript from templates
        boot_script = env.get_template(settings['server']['script'])
        user_data = boot_script.render(settings=settings, server=settings['server'])
    
        # Load ami info
        ami = AMI(settings)

        # Run server
        print 'Starting instance %s...' % server.get('name', server.get('type', ""))
        reservations.append((server, ec2_connection.run_instances(
            image_id=ami.id,
            key_name=settings['key_pair'],
            user_data=user_data,
            security_groups=[server.get('security_group', settings['security_group'])],
            instance_type=ami.size,
        )))
        
    # First setup our status flag and EC2 tags
    for server, reservation in reservations:
        for instance in reservation.instances:
            
            # Set status flag
            set_status(settings, instance.id)

            # Add tags to instance
            instance.add_tag('Name', server.get('name', 'untitled'))
            instance.add_tag('Hosts', server.get('hosts', ''))
            instance.add_tag('Type', server.get('type', recipe_name))
            instance.add_tag('OS', ami.os)
            instance.add_tag('Version', ami.version)
            instance.add_tag('Arch', ami.arch)
            instance.add_tag('Cluster', server.get('cluster', ''))
            
    
    # Monitor the booting servers, let the user know when they're running
    for server, reservation in reservations:
        for instance in reservation.instances:
            
            # Wait for the instance to come up
            while instance.state != 'running':
                draw_ascii_spinner(1)
                instance.update()
            sys.stdout.write('\r')
            
            print 'Server %s is booting. It will be available in a few minutes.' % instance.id

    # Now let us know when they finish
    for server, reservation in reservations:
        for instance in reservation.instances:
            
            # Check cloud commander status
            while check_status(settings, instance.id):
                draw_ascii_spinner(1)
            sys.stdout.write('\r')

            print '%s is at attention.' % server['name']
            print '  ssh -l USERNAME %s' % instance.public_dns_name

    # cleanup
    remove_assets(settings)
make_recipe
dataset/ETHPy150Open newsapps/cloud-commander/cloud_commander/recipes.py/make_recipe