Skip to content

Instantly share code, notes, and snippets.

@akkijp
Last active November 2, 2015 03:11
Show Gist options
  • Save akkijp/799a82afad72896cc43c to your computer and use it in GitHub Desktop.
Save akkijp/799a82afad72896cc43c to your computer and use it in GitHub Desktop.
aws をmacから起動するvagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
access_key = ENV['AWS_ACCESS_KEY']
access_secret = ENV['AWS_SECRET_KEY']
config.ssh.pty = false
config.vm.provider :aws do |aws, override|
aws.keypair_name = "vagrant"
aws.instance_type = "t2.micro"
aws.region = "ap-northeast-1"
aws.availability_zone = "ap-northeast-1c"
aws.ami = "ami-9a2fb89a"
aws.security_groups = [ 'vagrant' ]
aws.tags = {
"Name" => "vagrant-test",
"Description" => "vagrant test"
}
# enable sudo without tty
# NOTE: setting [ ssh.pty = true ] causes file provisioner fail
aws.user_data = <<-USER_DATA
#!/bin/sh
echo "Defaults !requiretty" > /etc/sudoers.d/vagrant-init
chmod 440 /etc/sudoers.d/vagrant-init
USER_DATA
# disable synced_folder:
override.vm.synced_folder "./", "/vagrant", disabled: true
override.ssh.username = "ec2-user"
override.ssh.private_key_path = "~/.ssh/vagrant.pem"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment