Vagrant一直试图使用AWS插件,如何停止?

6

我正在尝试第一次使用Vagrant启动一个标准的Ubuntu镜像。我的公司已经在我的笔记本电脑上安装了Vagrant并安装了一些AWS插件。当我尝试在个人Ubuntu镜像上运行vagrant up时,出现以下错误:

There are errors in the configuration of this machine. Please fix
the following errors and try again:

AWS Provider:
* An access key ID must be specified via "access_key_id"
* A secret access key is required via "secret_access_key"
* An AMI must be configured via "ami" (region: #{region})

我并不是在尝试连接AWS,我只是想在我的笔记本电脑上设置我的第一张个人图片。


1
你能提供你的Vagrantfile中provider部分吗? - BMW
Vagrantfile 中的所有内容都是默认的,在 vagrant init 命令创建时生成的。该文件中唯一没有被注释掉的部分是 config.vm.box ="puphpet/ubuntu1404-x64" - imagineerThat
2
你能否使用 --provider 选项运行 Vagrant? - BMW
请执行以下命令以启动虚拟机:vagrant up --provider virtualbox。谢谢! - imagineerThat
您可能有默认的环境变量指向提供者,您可以通过运行 env | grep VAGRANT 进行检查。然后,您可以通过更改值或删除变量来禁用默认的 AWS 提供者。 - Frederic Henri
2个回答

2
  1. Make sure you actually have VirtualBox installed. I witnessed this error message today and it was because I had the vagrant-aws plugin installed but not VirtualBox. Installing VirtualBox was all that was needed to fix the problem.
  2. If for some reason that still fails, then, per the OP's comment above, try using vagrant up's --provider option:

    vagrant up --provider virtualbox
    

1
默认情况下,Vagrant将浏览所有的config.vm.provider并选择第一个使用的提供程序,因此您应在aws之前添加virtualbox
  config.vm.provider "virtualbox" do |v|
    v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
    v.memory = 4096
    v.cpus = 2
  end

或者手动选择不同的提供程序,可以通过如上所述的--provider,或者VAGRANT_DEFAULT_PROVIDER变量来实现:

VAGRANT_DEFAULT_PROVIDER=virtualbox vagrant up

或者在Vagrantfile中使用没有配置的config.vm.provider来设置顺序,例如:

Vagrant.configure("2") do |config|
  # ... other config up here

  # Prefer VirtualBox Fusion before VirtualBox
  config.vm.provider "virtualbox"
  config.vm.provider "aws"
end

请查看:vagrantup.com上的基本提供者使用


如果您需要使用AWS提供程序,这些错误意味着您需要使用 aws configure 命令设置正确的凭据,以便可以使用您的 aws_access_key_id 和 aws_secret_access_key 值创建 ~/.aws/credentials 。有关 AMI配置,请检查插件的 README文件(基本上您需要将 aws.ami 添加到您的Vagrant文件中)。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接