Sunday 27 August 2017

Vagrant and AWS

An example Vagrantfile
 require 'vagrant-aws'  
  
 Vagrant.configure('2') do |config|  
   
  config.vm.box = "aws-box"  
  config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"  
   
  config.vm.define "jupiter" do |jupiter|  
    jupiter.vm.provision "shell", path: "install_ansible.sh"  
    jupiter.vm.provider 'aws' do |aws, override|  
      aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']  
      aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']  
      aws.keypair_name = 'vagrant'  
      aws.region = 'us-west-2'  
      aws.ami = 'ami-20be7540'  
      aws.security_groups = ['default']  
      override.ssh.username = 'ansible'  
      override.ssh.private_key_path = '~/ec2/keys/vagrant.pem'  
      aws.tags = {  
       'Name' => "ansible"  
      }  
    end  
  end  



1 comment: