satis egitimisatis


Discussion on the state of cloud computing and open source software that helps build, manage, and deliver everything-as-a-service.

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Login
Posted by on in Cloud News
  • Font size: Larger Smaller
  • Hits: 7125
  • Print
  • Report this post

New EC2 interface to CloudStack


CloudStack features an EC2 query interface that can be run on the management server. This is great, but written in Java and using axis can be a bit difficult to hack on and improve. EC2stack is a new project by CloudStack committer Ian Duffy and a buddy of his Darren Brogan from Dublin City University. They did this as part of their third year school project. Building on their previous experience with gstack, a GCE interface to CloudStack, they wrote a brand new EC2 interface to CloudStack.

The interface uses Flask microframework and is written 100% in Python. It also features a vagrant box for easy testing, lots of unittests and automatic build tests (pep8, pylint and coverage) via Travis CI. All around a pretty tight project. They did it on github and not directy in the Apache CloudStack trunk because it was a graded project. They did get permission to put it on github but could not accept pull requests :)

Getting Started with the vagrant box

Clone the repo and launch the vagrant box:

git clone
cd ec2stack
vagrant up

Within the VM you can now configure ec2stack:

mkvirtualenv ec2stack
cd /vagrant
python develop

Getting Started without vagrant

Just install ec2stack with:

sudo python ./ install

You might want to do it within a virtualenv environment.


In the vagrant box, create a virtual environment, and install the server, then configure it and run.

mkvirtualenv ec2stack
cd /vagrant
python develop

On your localmachine, you just need to configure and run the server with:


The configuration file will be store in ~/.ec2stack/ec2stack.conf and can be edited by hand as well. In order to verify the signature coming from any EC2 client and forward an authenticated request to your CloudStack enpoint we need to register the API access/secret keys. Currently this can be done with a curl command like so:

curl -d AWSSecretKey=aHuDB2ewpgxVuNNRC5NR5cUjEg -d AWSAccessKeyId=PQogHs2skbVdNPUn-mg -d Action=RegisterSecretKey http://localhost:5000

A nicer solution is being worked on. You are now ready to use ec2stack with your favorite EC2 client.

Using the AWS cli

If you are not using the vagrant box and installed everything on your local machine, you can then use the AWS CLI

sudo pip install aws-cli

Set your keys in the /.aws/config file or run aws configure. The region needs to be a valid AWS region. With the keys set you are now ready to use the aws cli, you just need to specify the endpoint of ec2stack

aws ec2 describe-images --endpoint=http://localhost:5000
aws ec2 describe-key-pairs --endpoint=http://localhost:5000
aws ec2 create-key-pair --endpoint=http://localhost:5000 --key-name=test

And so on, have a look at it, create security groups and start instances.

API coverage

Looking at the code only the following AWS APIs are covered:

def _get_action(action):
    actions = {
        'AttachVolume': volumes.attach_volume,
        'CreateKeyPair': keypairs.create_keypair,
        'CreateSecurityGroup': security_groups.create_security_group,
        'CreateVolume': volumes.create_volume,
        'DeleteKeyPair': keypairs.delete_keypair,
        'DeleteSecurityGroup': security_groups.delete_security_group,
        'DeleteVolume': volumes.delete_volume,
        'DescribeAvailabilityZones': zones.describe_zones,
        'DescribeImageAttribute': images.describe_image_attribute,
        'DescribeImages': images.describe_images,
        'DescribeInstanceAttribute': instances.describe_instance_attribute,
        'DescribeInstances': instances.describe_instances,
        'DescribeKeyPairs': keypairs.describe_keypairs,
        'DescribeSecurityGroups': security_groups.describe_security_groups,
        'DescribeVolumes': volumes.describe_volumes,
        'DetachVolume': volumes.detach_volume,
        'GetPasswordData': passwords.get_password_data,
        'ImportKeyPair': keypairs.import_keypair,
        'RebootInstances': instances.reboot_instance,
        'RegisterSecretKey': register_secret_key,
        'RemoveSecretKey': remove_secret_key,
        'StartInstances': instances.start_instance,
        'StopInstances': instances.stop_instance,
        'TerminateInstances': instances.terminate_instance,

The code is super clean and it will be easy to add more actions and provide a much better coverage really soon, pull request welcome as soon as Ian and Darren get their grades in :)

Rate this blog entry:
  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest Tuesday, 01 July 2014


Citrix supports the open source community via developer support and evangeslism. We have a number of developers and evangelists that participate actively in the open source community in Apache Cloudstack, OpenDaylight, Xen Project and XenServer. We also conduct educational activities via the Build A Cloud events held all over the world.