#1. Introduction
This repository contains sample scripts which illustrate how Apache Libcloud can be used to perform basic operations on Interoute's Virtual Data Centre cloud platform. For example, creating virtual machines ('nodes' in Libcloud terminology) and networks, assigning a public IP address to a virtual machine, applying port forwarding rules, and bootstrapping (running some initial commands to install software and configure the machine) a newly-deployed virtual machine.
The CLOUDSTACK driver for Libcloud is used, which is compatible with the Virtual Data Centre API.
#2. Prerequisites
Python 2.5 or later should be installed.
You should install the Python installer program, pip. (Install pip)
#3. Installation
Type in the terminal/command prompt:
pip install apache-libcloud
#4. Running the Libcloud scripts
First, you should edit the connection.py file to insert the API key, Secret key and access URL for your VDC account. (Instructions for finding VDC access keys)
Then, you can run the libcloud scripts by typing in a terminal / command prompt:
python <filename>.py
#5. Supported Libcloud commands
The table below shows the list of Libcloud commands, as contained in the CLOUDSTACK driver, which are supported by the VDC 2.0 API. Any Libcloud commands that are not in this list, are not supported for VDC 2.0.
| Libcloud Command | VDC 2.0 API Command |
|---|---|
| list_images | listTemplates |
| list_volumes | listVolumes |
| list_snapshots | listSnapshots |
| list_sizes | listServiceOfferings |
| list_nodes | listVirtualMachines |
| list_locations | listZones |
| list_key_pairs | listSSHKeyPairs |
| import_key_pair_from_string | registerSSHKeyPair |
| get_image | No Equivalent VDC command |
| ex_start | startVirtualMachine |
| ex_stop | stopVirtualMachine |
| ex_reboot | rebootVirtualMachine |
| ex_release_public_ip | disassociateIpAddress |
| ex_register_iso | registerIso |
| ex_list_public_ips | listPublicIpAddresses |
| ex_list_port_forwarding_rules | listPortForwardingRules |
| ex_list_os_types | listOsTypes |
| ex_list_nics | listNics |
| ex_list_networks | listNetworks |
| ex_list_network_offerings | listNetworkOfferings |
| ex_list_keypairs | listSSHKeyPairs |
| ex_list_firewall_rules | listFirewallRules |
| ex_list_egress_firewall_rules | listEgressFirewallRules |
| ex_list_disk_offerings | listDiskOfferings |
| ex_limits | listResourceLimits |
| ex_import_keypair_from_string | registerSSHKeyPair |
| ex_detach_nic_from_node | removeNicFromVirtualMachine |
| ex_delete_tags | deleteTags |
| ex_delete_port_forwarding_rule | deletePortForwardingRule |
| ex_delete_network | deleteNetwork |
| ex_delete_keypair | deleteSSHKeyPair |
| ex_delete_ip_forwarding_rule | deleteIpForwardingRule |
| ex_delete_firewall_rule | deleteFirewallRule |
| ex_delete_egress_firewall_rule | deleteEgressFirewallRule |
| ex_create_tags | createTags |
| ex_create_snapshot_template | createSnapshot |
| ex_create_port_forwarding_rule | createPortForwardingRule |
| ex_create_network | createNetwork |
| ex_create_keypair | createSSHKeyPair |
| ex_create_ip_forwarding_rule | createIpForwardingRule |
| ex_create_firewall_rule | createFirewallRule |
| ex_create_egress_firewall_rule | createEgressFirewallRule |
| ex_attach_nic_to_node | addNicToVirtualMachine |
| ex_allocate_public_ip | associateIpAddress |
| detach_volume | detachVolume |
| destroy_volume_snapshot | deleteSnapshot |
| destroy_volume | deleteVolume |
| destroy_node | destroyVirtualMachine |
| delete_key_pair | deleteSSHKeyPair |
| delete_image | deleteTemplate |
| create_volume_snapshot | createSnapshot |
| create_volume | createVolume |
| create_node | deployVirtualMachine |
| create_key_pair | createSSHKeyPair |
| create_image | createTemplate |
| copy_image | copyTemplate |
| attach_volume | attachVolume |
| balancer_attach_member | assignToLoadBalancerRule |
| balancer_detach_member | removeFromLoadBalancerRule |
| balancer_list_members | listLoadBalancerRuleInstances |
| create_balancer | createLoadBalancer |
| destroy_balancer | deleteLoadBalancer |
| get_balancer | No Equivalent VDC command |
| list_balancers | listLoadBalancerRules |
| list_protocols | No Equivalent VDC command |