Skip to content

Instantly share code, notes, and snippets.

@naoyes
Created January 31, 2014 16:42
Show Gist options
  • Select an option

  • Save naoyes/8735890 to your computer and use it in GitHub Desktop.

Select an option

Save naoyes/8735890 to your computer and use it in GitHub Desktop.
VagrantでAmazon Web ServicesのVPCにAmazon Linuxのインスタンスを作成 ref: http://qiita.com/naoyes/items/cdc5f340d1e9a0ccc65c
+ export MYAPP_AWS_ACCESS_KEY_ID=yourawsaccesskeyid
+ export MYAPP_AWS_SECRET_KEY=yourawssecretkey
vagrant plugin install vagrant-aws
vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
vagrant up prod.myapp --provider=aws
ap-northeast-1
ami-3561fe34
cd /path/to/myapp
vagrant init
stderr from the command:
sudo: sorry, you must have a tty to run sudo
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
AWSAccessKeyId=yourawsaccesskeyid
AWSSecretKey=yourawssecretkey
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "dev.myapp" do |machine|
machine.vm.box = "opscode-centos-6.5"
machine.vm.network :private_network, ip: "192.168.40.10"
end
config.vm.define "prod.myapp" do |machine|
machine.vm.box = "dummy"
machine.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['MYAPP_AWS_ACCESS_KEY_ID']
aws.secret_access_key = ENV['MYAPP_AWS_SECRET_KEY']
aws.region = 'ap-northeast-1'
aws.instance_type = 't1.micro'
aws.ami = 'ami-3561fe34'
aws.security_groups = [
'sg-XXXXXXXX', # WEB
'sg-YYYYYYYY', # SSH
]
aws.keypair_name = 'naoyes-myapp'
aws.tags = {
'Name' => 'MYAPP',
'Env' => 'PROD',
}
aws.subnet_id = 'subnet-ZZZZZZZZ'
override.ssh.username = "ec2-user"
override.ssh.private_key_path = '/Users/naoyes/.ssh/naoyes-myapp.pem'
override.ssh.pty = true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment