Nubo is a command line program that allows you to start virtual machines on different cloud providers, also making sure you can SSH into those instances once they are available.
As an example, you might want to start a new node on Amazon EC2:
$ export NUBO_CLOUD=EC2_EU_WEST
$ nubo start ami-27013f53
Instance i-4ea89004 available on EC2_EU_WEST. Public IP: 54.247.8.150
And then install puppet on it:
$ ssh root@54.247.8.150 "apt-get -y install puppet"
Warning: Permanently added '54.247.8.150' (RSA) to the list of known hosts.
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
[...]
One of the biggest challenges when deploying virtual machines on multiple clouds is ensuring you can actually access those machines after they have started up. For example, different cloud providers allow you to upload your SSH public key in different ways. Certain providers automatically configure firewall rules which by default deny traffic to your instances. If your deployments need to be automated, your infrastructure code has to deal with that.
nubo abstracts away these differences for you. It uses Apache Libcloud to start virtual machines on different cloud providers and Paramiko to establish SSH connections to the instances you start. Its functionalities are also available as a Python library.
Install nubo with one of the following commands:
$ pip install nubo
Alternatively, use easy_install:
$ easy_install nubo
You need to have ca-certificates installed on your system.
Invoke nubo without arguments to see the available functionalities:
$ nubo
usage: nubo [-h] {config,clouds,list,images,start,reboot,delete} ...
Start Virtual Machines on multiple clouds
positional arguments:
{config,clouds,list,images,start,reboot,delete}
config set your cloud credentials
clouds list available clouds
list list running VMs
images list available images
start start a new VM
reboot reboot a given VM
delete delete a given VM
optional arguments:
-h, --help show this help message and exit
Run nubo config to set your cloud credentials. The following examples shows how we can configure one of the available cloud providers:
$ nubo config
1 DIGITAL_OCEAN
2 EC2_AP_NORTHEAST
3 EC2_AP_SOUTHEAST
4 EC2_AP_SOUTHEAST2
5 EC2_EU_WEST
6 EC2_US_EAST
7 EC2_US_WEST
8 EC2_US_WEST_OREGON
9 OPENNEBULA
10 RACKSPACE
11 RACKSPACE_UK
Please choose the cloud provider you want to setup [1-11] 5
Please provide your API key: MYAPIKEY
Please provide your API secret: MYAPISECRET
EC2_EU_WEST cloud configured properly
To see which virtual machine images are available, we can use nubo images:
$ export NUBO_CLOUD=DIGITAL_OCEAN
$ nubo images
20 images available on DIGITAL_OCEAN
id name
===============================
85271 wheezy
85431 postgres-base
1607 Gentoo x64
13632 Open Suse 12.1 x32
13863 Open Suse 12.2 X64
18414 Arch Linux 2012-09 x64
23593 Arch Linux 2012-09 x64
63749 Gentoo 2013-1 x64
1601 CentOS 5.8 x64
1602 CentOS 5.8 x32
1609 Ubuntu 11.10 x32 Server
1611 CentOS 6.2 x64
1615 Fedora 16 x64 Server
1618 Fedora 16 x64 Desktop
2676 Ubuntu 12.04 x64 Server
12573 Debian 6.0 x64
12574 CentOS 6.3 x64
12575 Debian 6.0 x32
12578 CentOS 6.3 x32
14097 Ubuntu 10.04 x64 Server
New virtual machine instances can be started with nubo start. Note that the command will not return until the remote machine has finished booting up and it accepts SSH connections:
$ nubo start 12573
Instance 150843 available on DIGITAL_OCEAN. Public IP: 198.199.72.211
With nubo list we can see the status of our virtual machines on a given cloud provider:
$ nubo list
1 VMs running on DIGITAL_OCEAN
id name state ip
========================================
150843 test RUNNING 198.199.72.211
All nubo functionalities can be accessed via its Python API. Here is a brief example of how to deploy a new virtual machine:
from nubo.clouds.base import get_cloud
Cloud = get_cloud('EC2_EU_WEST')
ec2 = Cloud()
print ec2.deploy(image_id='ami-27013f53', name='my-new-vm')
Please refer to the following API documentation for further details.
Support deployments on multiple cloud providers.
copyright: |
|
---|
Return a class representing the given cloud provider.
Convert a node object into a dict
Bases: object
Deploy a VM instance on this cloud. This method is not implemented here, it has to be specialized by the classes implementing specific cloud providers.
Return True if the given node is running.
Return a list of VM images available on this cloud.
Return a list of dictionaries representing currently running nodes.
Return a list of strings representing the available instance size names.
Reboot the given instance id.
eg: reboot(‘i-bb6c3b88’) -> bool
Shutdown the given instance id.
eg: shutdown(‘i-bb6c3b88’) -> bool
Start a new instance.
Each cloud provider requires different values here.
‘name’, ‘image’, and ‘size’ are the lowest common denominator.
eg: startup(params) -> dict
Support deployments on DigitalOcean cloud.
copyright: |
|
---|
Bases: nubo.clouds.base.BaseCloud
Digital Ocean needs the following information: VM size, image, name, location and SSH key id.
First, we check if our SSH key is already uploaded on Digital Ocean’s cloud. If not, we upload it using libcloud’s driver.ex_create_ssh_key. Then, we call self.startup with the required arguments.
Return uploaded key id if this SSH public key has been already submitted to Digital Ocean. We use libcloud’s driver.ex_list_ssh_keys in order to find it out.
Return None if the SSH key still has to be uploaded.
Bases: nubo.clouds.base.BaseCloud
Amazon EC2 needs the following information: VM size, image, name, location, SSH key name and security group name.
First, we check if our SSH key is already uploaded on Amazon’s cloud. If not, we upload it using libcloud’s driver.ex_import_keypair.
Then, we create a permissive Security Group with driver.ex_create_security_group and driver.ex_authorize_security_group_permissive.
Finally, we call self.startup with the required arguments.
Return uploaded key id if this SSH public key has been already submitted to Amazon EC2. We use libcloud’s driver.ex_describe_keypairs in order to find it out.
Return None if the SSH key still has to be uploaded.
Amazon also returns kernel-related info in driver.list_images. We do not care about kernels here, only about bootable VM images (AMIs).
First, we get the list of available AMIs. Then, we search for the user-specified keyword (if any).
Only 20 results are returned by default to avoid flooding users with too much output.
Bases: nubo.clouds.base.BaseCloud
Rackspace supports libcloud’s libcloud.compute.deployment.
Pass an SSHKeyDeployment to self.driver.deploy_node.
Support deployments on OpenNebula private clouds.
copyright: |
|
---|
Bases: nubo.clouds.base.BaseCloud