启动 EC2 实例时出现 vagrant-aws 错误

启动 EC2 实例时出现 vagrant-aws 错误

我正在尝试使用 vagrant 启动带有亚马逊 EC2 服务的机器来自动化验收测试,因此我添加了虚拟盒并复制了 VagrantfileGithub,但是当我尝试运行时,vagrant up --provider=aws我得到以下输出:我对 ruby​​ 还很陌生,所以我不确定到底出了什么问题。

将机器‘默认’与‘aws’提供商整合在一起……

[默认] 警告!AWS 提供商不支持任何 Vagrant
高级网络配置 ( config.vm.network)。它们
将被默默忽略。
[默认] 使用以下设置启动实例...
[默认] -- 类型:m1.small
[默认] -- AMI:ami-5344d263
[默认] -- 区域:us-east-1
[默认] -- 密钥对:vagrant-keypair
/home/vagrant/.vagrant.d/gems/gems/excon-0.25.0/lib/excon/middlewares/expects.rb:10:in response_call': Expected(200) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest) from /home/vagrant/.vagrant.d/gems/gems/excon-0.25.0/lib/excon/connection.rb:353:in response' from /home/vagrant/.vagrant.d/gems/gems/excon-0.25.0/lib/excon/connection.rb:247:in request' from /home/vagrant/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/connection.rb:21:in request' from /home/vagrant/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/aws/compute.rb:384:in _request' from /home/vagrant/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/aws/compute.rb:379:in request' from /home/vagrant/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/aws/requests/compute/run_instances.rb:119:in run_instances' from /home/vagrant/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/aws/models/compute/server.rb:173:in save' 来自 /home/vagrant/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/collection.rb:52:in create' from /home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.2.2/lib/vagrant-aws/action/run_instance.rb:76:in call' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' from /home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.2.2/lib/vagrant-aws/action/warn_networks.rb:14:in call' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' from /home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.2.2/lib/vagrant-aws/action/sync_folders.rb:21:in call' 来自/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/provision.rb:45:in call' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in block in run' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in busy' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in run' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/call.rb:51:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' 来自/home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.2.2/lib/vagrant-aws/action/connect_aws.rb:41:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/config_validate.rb:25:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in call' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builder.rb:116:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in block in run' 来自 /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in busy' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in run' 来自/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/machine.rb:147: action' from /opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/batch_action.rb:63:in 在运行中阻止(2 个级别)'

重新编译后运行出错:

并行执行多个操作时发生错误。发生的所有错误如下所示。

An unexpected error ocurred when executing the action on the
'default' machine. Please report this as a bug:

undefined method `Errors' for Excon:Module

/home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.3.0.dev/lib/vagrant-aws/action/run_instance.rb:91:in `rescue in call'
/home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.3.0.dev/lib/vagrant-aws/action/run_instance.rb:61:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.3.0.dev/lib/vagrant-aws/action/warn_networks.rb:14:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.3.0.dev/lib/vagrant-aws/action/sync_folders.rb:21:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/provision.rb:45:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/call.rb:51:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/home/vagrant/.vagrant.d/gems/gems/vagrant-aws-0.3.0.dev/lib/vagrant-aws/action/connect_aws.rb:41:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/handle_box_url.rb:72:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builder.rb:116:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/machine.rb:147:in `action'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'

答案1

您可能会受益于此补丁,它应该记录实际的错误响应:https://github.com/mitchellh/vagrant-aws/pull/101

答案2

这可能与该地区的 ami 不正确有关#101

这已经固定的在最近vagrant-aws,因此请升级您的宝石通过:

vagrant plugin update

或从应用补丁拉取请求通过以下步骤:

cd ~/.vagrant.d/gems/gems/vagrant-aws-*/
patch -p1 <(curl https://patch-diff.githubusercontent.com/raw/mitchellh/vagrant-aws/pull/101.patch)

相关内容