我正在努力使用Vagrant在AWS e2实例上部署Yii2应用程序。我有服务器IP,用户名,访问密钥ID,秘密访问密钥,控制台登录链接和pem文件。是否可以通过Vagrant使用上述信息在aws上部署yii2应用程序?
答案 0 :(得分:0)
您可以使用:
require 'vagrant-aws'
Vagrant.configure('2') do |config|
config.vm.box = 'dummy'
config.vm.provider 'aws' do |aws, override|
aws.access_key_id = “xxxxxxxxxxxxxxxxxxxxxxxxxxx”
aws.secret_access_key = “xxxxxxxxxxxxxxxxxxxxxxxxxx”
aws.keypair_name = 'ssh-keypair-name'
aws.instance_type = "t2.micro”
aws.region = 'us-east-1'
aws.ami = 'ami-20be7540'
aws.security_groups = ['default']
override.ssh.username = 'ubuntu'
override.ssh.private_key_path = '~/.ssh/ssh-keypair-file'
end
end
查看以下页面以获取更多信息:
http://www.tothenew.com/blog/using-vagrant-to-deploy-aws-ec2-instances/
和
https://github.com/mitchellh/vagrant-aws
对于“ aws.region”,找到您的区域。有关更多信息:https://docs.aws.amazon.com/general/latest/gr/rande.html