Skip to content

Instantly share code, notes, and snippets.

@sumitramteke
Forked from arbabnazar/vagrant-aws
Last active August 18, 2016 15:26
Show Gist options
  • Save sumitramteke/86ba74f5c02b19dd04b2d1ec5c4503d7 to your computer and use it in GitHub Desktop.
Save sumitramteke/86ba74f5c02b19dd04b2d1ec5c4503d7 to your computer and use it in GitHub Desktop.
vagrant file for creating an ec2 instance on aws
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "aws"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY']
aws.secret_access_key = ENV['AWS_SECRET_KEY']
aws.region = "us-west-2" #here Oregon : for regions http://goo.gl/1FVaRZ
aws.availability_zone = "us-west-2a"
# AMI from which we'll launch EC2 Instance
aws.ami = "ami-d732f0b7" # Ubuntu 14.04
aws.keypair_name = "vagrant"
aws.instance_type = "t2.micro"
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 10 }]
aws.security_groups = ["vagrant-sg"]
aws.tags = {
'Name' => 'Vagrant EC2 Instance',
'Environment' => 'vagrant-sandbox'
}
# Credentials to login to EC2 Instance
override.ssh.username = "ubuntu"
override.ssh.private_key_path = ENV['AWS_PRIVATE_KEY']
end
# Configuration for Ansible as Provisioner
config.vm.provision :ansible do |ansible|
ansible.playbook = "site.yml"
ansible.verbose = "v"
ansible.host_key_checking = false
ansible.limit = 'all'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment