Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example Vagrant configuration for use with Amazon Web Services (vagrant-aws plugin)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant on AWS Example
# Brian Cantoni
# This sample sets up 1 VM ('delta') with only Java installed.
# Adjustable settings
CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc.
# Provisioning script
node_script = <<SCRIPT
# set timezone
echo "#{CFG_TZ}" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# install a few base packages
apt-get update
apt-get install vim curl zip unzip git python-pip -y
# install java
apt-get install openjdk-7-jre -y
echo Provisioning is complete
# Configure VM server
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :delta do |x| = "hashicorp/precise64"
x.vm.hostname = "delta"
x.vm.provision :shell, :inline => node_script
x.vm.provider :virtualbox do |v| = "delta"
x.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_KEY']
aws.secret_access_key = ENV['AWS_SECRET']
aws.keypair_name = ENV['AWS_KEYNAME']
aws.ami = "ami-a7fdfee2"
aws.region = "us-west-1"
aws.instance_type = "m3.medium" = "dummy"
override.ssh.username = "ubuntu"
override.ssh.private_key_path = ENV['AWS_KEYPATH']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.