Pergunta

I intended to using Vagrant,Chef-solo to establish a AWS environment.But I got some errors that I can not solve.Anybody can help me?

The steps I used:

  1. Install all necessary environment on Mac OS X: such as vagrant, vagrant plugin, virtual box, chef, chef plugin and so on.

  2. Download vagrant configuration files:

    git clone https://github.com/ICTatRTI/ict-chef-repo
    
  3. Vagrantfile

    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    Vagrant.configure("2") do |config|
      # All Vagrant configuration is done here. The most common configuration
      # options are documented and commented below. For a complete reference,
      # please see the online documentation at vagrantup.com.
      #config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.2.0.box"
      #config.vm.box = "opscode-ubuntu-1204"
      config.vm.box = "dummy"
      config.vm.network :forwarded_port, guest: 80, host: 8888
      config.vm.network :forwarded_port, guest: 3306, host: 3333
      config.ssh.username = "ubuntu"
    
      config.vm.provider :aws do |aws, override|
      #config.vm.provider :aws do |aws|
        aws.access_key_id     = 'XXXXXXXXXXXXXXXQ'
        aws.secret_access_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
        aws.keypair_name = "usr-aws-2013"
        aws.availability_zone = "us-west-2c"
        aws.instance_type = "t1.micro"
        aws.region = "us-west-2"
        aws.ami = "ami-0849a03f"
        aws.security_groups = ['quicklaunch-1']
        aws.tags = { 
          'Name' => 'tong',
          'Description' => 'vagrant test'
        } 
        override.ssh.private_key_path = "~/.ssh/usr-aws-2013.pem"
        override.ssh.username = "ubuntu"
      end
      config.vm.provision :chef_solo do |chef|
    
         chef.node_name = 'base' 
         chef.cookbooks_path = "./cookbooks"
         chef.roles_path = "./roles"
         chef.add_role "base"
         chef.add_role "ushahidi"
       end
    
    end
    
  4. Run:

    vagrant up --provider=aws
    
  5. Got the following errors

    Bringing machine 'default' up with 'aws' provider...
    WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
    [default] Warning! The AWS provider doesn't support any of the Vagrant
    high-level network configurations (`config.vm.network`). They
    will be silently ignored.
    [default] Launching an instance with the following settings...
    [default]  -- Type: t1.micro
    [default]  -- AMI: ami-0849a03f
    [default]  -- Region: us-west-2
    [default]  -- Availability Zone: us-west-2c
    [default]  -- Keypair: usr-aws-2013
    [default]  -- Security Groups: ["quicklaunch-1"]
    [default]  -- Block Device Mapping: []
    [default]  -- Terminate On Shutdown: false
    An error occurred while executing multiple actions in parallel.
    Any errors that occurred are shown below.
    
    An unexpected error ocurred when executing the action on the
    'default' machine. Please report this as a bug:
     The image id '[ami-0849a03f]' does not exist
    
Foi útil?

Solução

Instance and AMI are different things and they have different numbers too. So if you have i-bddcf889 you cannot reference it in your Vagrantfile as ami-bddcf889.

Instead you don't have to create/start instance manually - you must provide ami from which Vagrant will create instance itself. For example take the one you made instance manually from.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top