vagrant + aws:下载错误 'dummy'

vagrant + aws: error downloading 'dummy'

我实际上是在使用 https://github.com/mitchellh/vagrant-aws 中给出的入门指南中的默认值。我设置了 access/secret keys + keypair 来使用环境变量:

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"

  config.vm.provider :aws do |aws, override|
    aws.access_key_id = ENV['AWS_ACCESS_KEY']
    aws.secret_access_key = ENV['AWS_SECRET_KEY']
    #aws.session_token = "SESSION TOKEN"
    aws.keypair_name = ENV['AWS_KEYPAIR']

    aws.ami = "ami-7747d01e"

    override.ssh.username = "ubuntu"
    override.ssh.private_key_path = "~/.ssh/id_rsa"
  end
end

我运行vagrant up --provider=aws:

Bringing machine 'default' up with 'aws' provider...
==> default: Box 'dummy' could not be found. Attempting to find and install...
    default: Box Provider: aws
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'dummy' (v0) for provider: aws
    default: Downloading: dummy
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/username/vagrants/ec2test/dummy

你需要添加dummy框,vagrant将无法找到这个框并从atlas下载。

一定要自己加框

vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box

之后效果会更好

要获得更便携的解决方案,请将此行添加到您的配置中(在 config.vm.box 下方):

config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"