Created
January 31, 2014 16:42
-
-
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
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
| + export MYAPP_AWS_ACCESS_KEY_ID=yourawsaccesskeyid | |
| + export MYAPP_AWS_SECRET_KEY=yourawssecretkey |
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
| vagrant plugin install 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
| vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box |
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
| vagrant up prod.myapp --provider=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
| ap-northeast-1 |
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
| t1.micro |
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
| ami-3561fe34 |
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
| cd /path/to/myapp | |
| vagrant init |
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
| 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.
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
| AWSAccessKeyId=yourawsaccesskeyid | |
| AWSSecretKey=yourawssecretkey |
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
| 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