View on GitHub

As-libcloud

An extension to Libcloud enabling native cloud providers Auto Scaling capabilities.

Download this project as a .zip file Download this project as a tar.gz file

Auto Scaling enabled libCloud

An extension to Libcloud enabling native cloud providers Auto Scaling capabilities.

Features

Supported providers:

Auto Scale Groups:

Auto Scale Policies:

Auto Scale Alarms:

Installation

$ git clone https://github.com/Cloud-Elasticity-Services/as-libcloud.git
$ cd as-libcloud
$ python setup.py install

Usage Examples

$ python

>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> cls = get_driver(Provider.SOFTLAYER)

# Use account username and api key
>>> username = ....
>>> api_key = ....
>>>driver = cls(username, api_key)

# Create an auto scale group
>>> group = driver.create_auto_scale_group(name="test",min_size=1,
               max_size=5, cooldown=300,
               image=driver.list_images()[0])

# List auto scale groups
>>> driver.list_auto_scale_groups()

# Create policy that when triggered, increments group membership 
# by one
>>> policy=driver.create_auto_scale_policy(group,
       name='test-policy',
       adjustment_type='CHANGE_IN_CAPACITY',
       scaling_adjustment=1)

# Add an alarm to policy.
# Alarm triggers the policy when cpu utilization 
# of group members is beyond 80%
>>> alarm = driver.create_auto_scale_alarm(name='my_alarm',
       policy=policy, metric_name='CPU_UTIL', operator='GT',
       threshold=80, period=120)

# List alarms for this policy
>>> driver.list_auto_scale_alarms(policy)

# List policies for this group
>>> driver.list_auto_scale_policies(group)

# Delete alarm
>>> driver.delete_auto_scale_alarm(alarm)