Skip to content

Instantly share code, notes, and snippets.

@pidah
Created July 11, 2013 11:32
Show Gist options
  • Save pidah/5974672 to your computer and use it in GitHub Desktop.
Save pidah/5974672 to your computer and use it in GitHub Desktop.
deploy multiple (in this case 2) AWS instances in different regions in a single Vagrantfile
Vagrant.require_plugin "vagrant-aws"
Vagrant.configure("2") do |config|
config.vm.define :usa do |usa_config|
usa_config.vm.provider :aws do |aws, override|
override.vm.box = "ubuntu_aws"
override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
override.ssh.private_key_path = ".vagrant/web.pem"
override.ssh.username = "ubuntu"
aws.keypair_name = "web"
aws.instance_type = "t1.micro"
aws.security_groups = "web"
aws.region = "us-east-1"
aws.ami = "ami-c5afc2ac"
aws.tags = {
'Name' => 'usa webserver',
}
end
usa_config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "init.pp"
puppet.options = ["--verbose"]
end
end
config.vm.define :eu do |eu_config|
eu_config.vm.provider :aws do |aws, override|
override.vm.box = "ubuntu_aws"
override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
override.ssh.private_key_path = ".vagrant/multi.pem"
override.ssh.username = "ubuntu"
aws.keypair_name = "multi"
aws.instance_type = "t1.micro"
aws.security_groups = "default"
aws.region = "eu-west-1"
aws.ami = "ami-ce7b6fba"
aws.tags = {
'Name' => 'eu server',
}
end
eu_config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "init.pp"
puppet.options = ["--verbose"]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment