AWS based Vagrantfile example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SettingsAws | |
AWS_ACCESS_KEY = "decafbaddecafbad" | |
AWS_SECRET_KEY = "decafbaddecafbad" | |
AWS_KEY_PEMNAME = "id_rsa.pub" | |
AWS_KEY_PEMPATH = "/home/bloggsf/.ssh/id_rsa" | |
AWS_SUBNET = "subnet-1f9dd97b" | |
AWS_SEC_GROUP = "sg-31c2d144" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'settings_aws.rb' | |
include SettingsAws | |
Vagrant.configure(2) do |config| | |
config.vm.provider :aws do |aws, override| | |
config.vm.box = "ShowMaker2017" | |
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box" | |
# AWS Credentials: | |
aws.access_key_id = AWS_ACCESS_KEY | |
aws.secret_access_key = AWS_SECRET_KEY | |
aws.keypair_name = AWS_KEY_PEMNAME | |
aws.security_groups = [ AWS_SEC_GROUP ] | |
aws.subnet_id = AWS_SUBNET | |
# AWS Location: | |
aws.region = "us-east-1" | |
aws.region_config "us-east-1", :ami => "ami-c29e1cb8" | |
aws.instance_type = "t2.micro" | |
aws.tags = { 'Name' => "ShowMaker2017" } | |
# AWS Storage: | |
aws.block_device_mapping = [{ | |
'DeviceName' => "/dev/sda1", | |
'Ebs.VolumeSize' => 30, | |
'Ebs.DeleteOnTermination' => true, | |
'Ebs.VolumeType' => "gp2", | |
}] | |
# SSH: | |
override.ssh.username = "ubuntu" | |
override.ssh.private_key_path = AWS_KEY_PEMPATH | |
override.nfs.functional = false | |
end | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provision "shell", inline: "bash /vagrant/run_setup.sh" | |
config.vm.provision "shell", run: "always", inline: <<-SHELL | |
touch /vagrant/log | |
tail -f -n 0 /vagrant/log & | |
nohup -- bash /vagrant/run_showmaker.sh | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment