This is my AWS setup:

  • 1 VPC with:
    • default public subnet,
      • 1 EC2 micro instance, private and public Elastic IP
    • 1 RDS instance, running MySQL

The EC2 instance has network connection to the outside world (verified with ping This is it's routing table:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         ip-10-0-0-1.eu-         UG    0      0        0 eth0        *        U     0      0        0 eth0
instance-data.e *      UH    0      0        0 eth0

The EC2 instance can also connect to the RDS instance.

What I want, is to launch a second EC2 instance (Amazon Linux AMI 2014.03.1 64bit) from inside the first EC2 instance, using Vagrant. The second EC2 instance should be in the same VPC subnet but it's actual IP address doesn't matter much. It also doesn't need a public Elastic IP. It does need to connect to the outside world, to install software using yum.

This is my Vagrantfile:


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

  config.vm.provider :aws do |aws, override|
    aws.access_key_id = "ACCESS_KEY_ID"
    aws.secret_access_key = "SECRET_ACCESS_KEY"
    aws.keypair_name = "KEYPAIR_NAME"

    aws.ami = "ami-2918e35e"
    aws.instance_type = "m1.small"
    aws.region = "eu-west-1"

    aws.subnet_id = "subnet-SUBNETID"
    aws.security_groups = "sg-SECURITYGROUPID"

    override.ssh.username = "ec2-user"
    override.ssh.private_key_path = "PRIVATE_KEY.pem"

  config.ssh.pty = true
  config.vm.provision "shell", path: "provision.sh"

In the shell script provision.sh I install some software:

yum install -y subversion

This fails, because yum can't connect to the outside network.

When I do vagrant ssh and check the IP address, it's in the range and I can ping in either direction between the two EC2 instances (ICMP was allowed in the security group). I can't ping and I can't yum install software because the instance can't reach the repositories. I checked the route and it's identical to that of the first instance.

Also, in the AWS web console, the second instance doesn't have a public IP address.

When I add this line to my Vagrantfile:

aws.associate_public_ip = true

then I get the following error on vagrant up --provider=aws --provision:

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: associate_public_ip

and the instance does not launch.

So my question is: how can I give the vagrant instance a network connection, without using an Elastic IP?


in my installation that parameter was not exist but there is

aws.elastic_ip = true

that has the same purpose.

To find the real fields used in your plugins chech this file


of course I have the vagrant-aws-0.4.1 change with yours

| improve this answer | |
  • @davidski on Github explains aws.elastic_ip vs associate_public_ip: They're very similar, but not quite identical. Elastic IPs are primarily static assignments which you "own" and can assign to instances as those hosts come and go, providing a static IP reference you can use again and again. Public IPs are only valid for the life of an instance. If you bring up a new instance, you'll get a random public IP address. There is a default limit of 10 Elastic IPs per account and you pay for any Elastic IPs you have checked out (allocated) but which are not in use by an active instance. – Amedee Van Gasse Jun 6 '14 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.