How to define memory in aws ec2 on vagranfile

249 views
Skip to first unread message

kiran sharma

unread,
Dec 8, 2015, 9:39:09 PM12/8/15
to Vagrant
The following code snippet works for virtualbox 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.provider "virtualbox" do |vb|
     # Display the VirtualBox GUI when booting the machine
     vb.gui = true
     vb.name = vmName
     # Customize the amount of memory on the VM:
     vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
     vb.customize ["modifyvm", :id, "--draganddrop", "bidirectional"]
     vb.memory = "4094"
   end

but in aws provider, 

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

      aws.vm.provider :aws do |aws, override|
      aws.access_key_id = ""
      aws.secret_access_key = ""
      aws.keypair_name = ""
      aws.ami = "ami-"
      aws.region = "us-east-1"
      aws.security_groups = [""]
      aws.subnet_id = ""
      aws.instance_type = ""
      aws.elastic_ip = true
      override.vm.box = "dummy"
      aws.tags = {
            "Name" => "",
        }
      override.vm.synced_folder "data", "/vagrant_data4"
      override.vm.hostname = "vmHost"
      override.ssh.username  = "ec2-user"
      override.ssh.private_key_path = "C:/VAGRANT/aws/"
      aws.size="4096mb" -- does not work 
                override.vmname=vmName --- does not work

    end
  end


I also tried 
override.size="4096mb" 


Also, I can not use
   override.vmname=vmName-- statement in the aws provisioning but 
 

But both of these work in virtualbox provider

Thanks
Kiran

Alvaro Miranda Aguilera

unread,
Dec 9, 2015, 12:46:38 AM12/9/15
to vagra...@googlegroups.com
Hello,

I think the size of instance in AWS is tied up the instance type

so choose an AMI that is on the size you are after.

What OS are you after?

Alvaro
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> 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 vagrant-up+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/7bd12ee7-5bec-4169-acde-dfb90e4b552e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

kiran sharma

unread,
Dec 9, 2015, 3:31:30 AM12/9/15
to Vagrant
I am choosing redhat linux

I tried with aws.instance_type = "m4.large" but getting errors still 


C:\vagrant\aws>vagrant status
There are errors in the configuration of this machine. Please fix
the following errors and try again:

AWS Provider:
* The following settings shouldn't exist: customize, memory, size

Vagrant:
* Unknown configuration section 'customize'.
* Unknown configuration section 'memory='.
* Unknown configuration section 'size='.


configurations 

      override.size="409" 
      override.memory="4096" 
      aws.memory = "4094"
      aws.size = "4094"
      override.customize ["modifyvm", :id, "--memory", "4096"]
      aws.customize ["modifyvm", :id, "--memory", "4096"]

kiran sharma

unread,
Dec 9, 2015, 7:58:55 AM12/9/15
to Vagrant
(Resolved) I realized that I do not need any config for memory as the memory is configured based on the instance type as you indicated. 


thanks a lot
kiran
Reply all
Reply to author
Forward
0 new messages