Skip to content

Instantly share code, notes, and snippets.

@chris-gunawardena
Last active December 27, 2015 20:29
Show Gist options
  • Save chris-gunawardena/7384907 to your computer and use it in GitHub Desktop.
Save chris-gunawardena/7384907 to your computer and use it in GitHub Desktop.
Example for using Vagrant with Amazon EC2 aws provider
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
#$ vagrant plugin install vagrant-aws
config.vm.provider :aws do |aws, override|
aws.access_key_id = "XXXXXXXXXXXXXXX" #https://console.aws.amazon.com/iam/home?#security_credential
aws.secret_access_key = "XXXXXXXXXXXXXXX" #https://console.aws.amazon.com/iam/home?#security_credential
aws.keypair_name = "ec2" #https://console.aws.amazon.com/ec2/v2/home?region=ap-southeast-2#KeyPairs:
aws.ami = "ami-3d128f07" #Ubuntu Server 12.04.3 LTS Server - ami-3d128f07 (64-bit)
aws.region = "ap-southeast-2"
aws.instance_type = "t1.micro"
override.ssh.username = "ubuntu"
override.ssh.private_key_path = "/Users/chris/Documents/PROJECTS/vagrant/ec2.pem"
end
config.vm.provision "shell", inline: "echo 'Hello world' >> ~/vagrant_shell_provisioner.log" #Just an example, should be chef/berkshelf
end
# Remeber to allow port 22 in the default security group
# https://console.aws.amazon.com/ec2/home?region=ap-southeast-2#s=SecurityGroups
#$ vagrant up --provider=aws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment