Hi,


It is my original configuration and it works well

   config.vm.provider :aws do |aws, override|

      aws.access_key_id = aws_access_key_id
      aws.secret_access_key = aws_secret_access_key
      aws.keypair_name = "ubuntu-pdf-convertor-konga"
      aws.security_groups = ["SlideGo-Server"] 

      # Specify parameters required for an EC2 instance
      aws.instance_type = "t2.small"

      # Tags
      aws.tags = {
        'Name' => server_name
      }

      aws.availability_zone = "us-west-2a"
      aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 
'Ebs.VolumeSize' => 32 }]

      # Defalut to US West (Northern California)
      aws.region = "us-west-2"
      aws.ami = "ami-33db9803"

      # Use a dummy box for the AWS provider
      override.vm.box = "dummy"
      override.ssh.username = "ubuntu"
      override.ssh.private_key_path = "mykey.pem"
    end


Now I want to be able to spawn multiple machines at the same time. So I added 
(1..num_server).each do |i| around existing code



  (1..num_server).each do |i| 
    config.vm.define "server-#{i}" do |server|



     config.vm.provider :aws do |aws, override|

        aws.access_key_id = aws_access_key_id
        aws.secret_access_key = aws_secret_access_key
        aws.keypair_name = "ubuntu-pdf-convertor-konga"
        aws.security_groups = ["SlideGo-Server"] 

        # Specify parameters required for an EC2 instance
        aws.instance_type = "t2.small"

        # Tags
        aws.tags = {
          'Name' => server_name
        }

        aws.availability_zone = "us-west-2a"
        aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 
'Ebs.VolumeSize' => 32 }]

        aws.region = "us-west-2"
        aws.ami = "ami-33db9803"

        # Use a dummy box for the AWS provider
        override.vm.box = "dummy"
        override.ssh.username = "ubuntu"
        override.ssh.private_key_path = "mykey.pem"
      end

    end

  end 


But now when I run vagrant up --provider=aws, I got this error message:



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"
* vagrant_aws.config.ami_required

I cannot figure out what have I done wrong. How can I fix my Vagrantfile?


Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to