Created
June 18, 2016 06:37
-
-
Save trengrj/44ab87af39d616fdaea5a386e6ee49f7 to your computer and use it in GitHub Desktop.
Vagrantfile for nginx using vagrant-aws
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrant on AWS Example | |
# Provisioning script | |
provision_script = <<SCRIPT | |
#!/bin/bash | |
SYNC_DIRECTORY=/home/ubuntu/sync | |
sudo apt-get update | |
sudo apt-get install -y nginx | |
sudo cp ${SYNC_DIRECTORY}/conf/nginx.conf /etc/nginx/sites-enabled/default | |
sudo cp -r ${SYNC_DIRECTORY}/www /var/www | |
sudo service nginx restart | |
echo Provisioning complete | |
SCRIPT | |
Vagrant.configure(2) do |config| | |
config.vm.box = 'dummy' | |
config.vm.synced_folder '.', '/home/ubuntu/sync', type: 'rsync', rsync__exclude: '.git/' | |
config.vm.provision :shell, :inline => provision_script | |
config.vm.provider :aws do |aws, override| | |
#AWS Settings | |
aws.access_key_id = ENV['AWS_KEY'] | |
aws.secret_access_key = ENV['AWS_SECRET'] | |
aws.keypair_name = ENV['AWS_KEYNAME'] | |
aws.region = ENV['AWS_REGION'] | |
aws.ami = 'ami-6c14310f' | |
aws.instance_type = 't2.micro' | |
aws.security_groups = ['web-ssh'] | |
aws.tags = { | |
'Name' => 'deploy-blog' | |
} | |
#Override Settings | |
override.ssh.username = 'ubuntu' | |
override.ssh.private_key_path = ENV['AWS_KEYPATH'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment