Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

socialpoint/mico

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mico: a monkey in the cloud

Mico is a tool-toy to manage a number of hosts deployed in cloud services (currently only support Amazon AWS), and also allows you to deploy new hosts with specified template or create autoscaling groups and manage them easily.

Latest PyPI version

Number of PyPI downloads

Installation

As usual, mico is available from pypi, and can be installed using pip:

pip install mico

Mico just need an AWS key ID and AWS secret key to run. By default mico just take this variables from the OS environment:

export AWS_ACCESS_KEY_ID="*foo*"
export AWS_SECRET_ACCESS_KEY="*bar*"

QuickStart

Mico works using the concept of template. A template is just a python code (with steroids which we call libraries), the template can implements a number of actions to perform in the cloud. In this example we just create a new host in AWS and install some packages there.

from mico.lib.aws import *
from mico.lib.core import *

def deploy(*args):
    for host in args:
        instance = ec2_ensure(
            ami = "ami-3d4ff254",
            name = host,
            instance_type = "t1.micro",
            key_name = "root-us-east-virginia",
            security_groups = "sec-test"
        )

        package_ensure("python") # of course :)
        package_ensure("apache")

Once, your template is created, you need to put it into a mico template path (by default uses /etc/mico and ~/.config/mico/, and the current working directory.

Then you can just run mico

$ mico template:deploy myhost1.mydomain.com myhost2.mydomain.com
mico:cloud:deploy:create security group: sec-test
mico:cloud:deploy:create instance: i-4543123
mico:cloud:deploy:use existent security group: sec-test
mico:cloud:deploy:create instance: i-2291281

You can see more complex (and useful!) templates in examples directory.

View template examples