How to use Vagrant with Outscale Cloud


What is Vagrant ?

Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the "works on my machine" excuse a relic of the past.

—Vagrant website (

Vagrant installation

You can download and install Vagrant by following this link :

To install aws plugin into Vagrant use the command line :

$ vagrant plugin install vagrant-aws

Now the ec2 plugin is installed and you need a Vagrant box to use it. With ec2 provider you don't need a linux box as for VirtualBox, just a metadata box.

You can download the Outscale box by downloading the box and installing it :

$ wget -O /tmp/

Install Outscale box with Vagrant command line :

$ vagrant box add /tmp/ --name ows

When you install a new box, a new directory is created in ~/.vagrant.d/boxes/ . So take a look at ~/.vagrant.d/boxes/ows/0/aws/ :

$ ls -1 ~/.vagrant.d/boxes/ows/0/aws/
$ cat ~/.vagrant.d/boxes/ows/0/aws/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

vagrant.configure("2") do |config|
  config.vm.provider :aws do |aws|
    aws.ami = "ami-37f43c43"
$ cat ~/.vagrant.d/boxes/ows/0/aws/metadata.json
        "provider": "aws"

The Vagrantfile contains some default values like ami and other stuff you need by default, and a metadata.json file only containing the Vagrant provider.

Check th ec2 plugin is enabled :

$ vagrant box list
ows (aws, 0)

That means your Vagrant installation is fully functional with the ec2 plugin.

Oustcale Cloud

Outscale Cloud plateform provides an API like AWS, with full compatibility with the Amazon Web Services. To deploy VMs over Outscale Cloud you'll need at least :

* access key
* secret key
* endpoint url

Both of access key and secret key are your own and endpoint url is the same for eu-west-1 region :

* endpoint_url =

Oustcale provides as well as AWS ressources listed below :

* security groups
* Snapshots (ec2 and EBS)
* keypair
* and many others you probably don't need here

You will need some of these ressources to deploy virtual instances with Vagrant over Oustcale Cloud.

Vagrant over Outscale

Vagrant uses a single file for its configuration : Vagrantfile .

Here is a sample configuration file :

# -*- mode: ruby -*-
 # vi: set ft=ruby :

 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!

 vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "precise64-byaf" "forwarded_port", id: "ssh", guest: 22, host: 2222, disabled: true
   config.vm.host_name = "my-yaf" :private_network, ip: "" "forwarded_port", guest: 22, host: 2221, auto_correct: true
   config.vm.provider "virtualbox" do |v|
     v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     v.customize ["modifyvm", :id, "--memory", 2048]

In this sample, Virtualbox is used as provider (that's the default behaviour).

Here is a sample configuration file using aws (over Outscale) as provider :

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!

vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "ows"

  config.vm.host_name = ""

  config.vm.provider "aws" do |aws, override|
    aws.access_key_id = "--REMOVED--"
    aws.secret_access_key = "--REMOVED--"
    aws.endpoint = ""
    aws.keypair_name = "ows-demo-prd"
    aws.region = "eu-west-1"
    aws.security_groups = ["default","web"]
    aws.instance_type = "m1.large"
    aws.ebs_optimized = 'True'

    aws.ami = "ami-7c5fa20e"
    aws.tags = {
        Name: 'Vagrant',
        Env: 'dev'

    override.ssh.username = "root"
    override.ssh.private_key_path = "/Users/bzhtux/.ssh/ows-demo-prd.pem"

end : "ows" is your Outscale box

config.vm.host_name : this is an arbitrary hostname

aws.access_key_id : your Outscale access_key

aws.secret_Access_key : your Outscale secret_key

aws.endpoint : use Outscale API to deploy your VMs

aws.keypair_name : your favorite Outscale keypair

aws.region : eu-west-1 to deploy in France

aws.security_groups : Your Outscale security groups (here default let me log in with ssh and web open 80 port)

aws.instance_type : Choose your Outscale instance type

aws.ebs_optimized : use IOPS

aws.ami : Your favorite AMI or you can choose a public one

aws.tags : Set your tags here

override.ssh_username : in order to vagrant works over Outscale cloud override ssh.username with root account.

override.ssh.private_key_path : this one should be the same as aws.keypair_name

Then you can see the provider section, filled with the Outscale ressources values.

Then to launch a virtual instance :

$ vagrant up --provider aws

Enjoy your first Vagrant VM over Outscale Cloud :)

Some samples are available following this link :


You can also provide a provisioner like puppet or ansible or what you want if it's supported.

To use provisionning with Vagrant, you should use :

  vm.provision "ansible" do |ansible|
    ansible.playbook = "ansible/common.yml"
    ansible.limit = 'all'
    #ansible.verbose = "vvvv"
    ansible.groups = {
      "web" => ["www-1","www-2"],
      "database" => ["bdd"]

and replace ansible with the provisioner you choosed.

Ansible is used to provision all my virtual instances (www-1, www-2 and dbb).

Ansible documentation is not cover by this post, a new one will be dedicated to Ansible.

Comments !