Unable to to create virtual machines in Amazon EsC2 using vagrant.

308 views
Skip to first unread message

Pratip Ghosh

unread,
Sep 8, 2015, 3:23:27 AM9/8/15
to Vagrant
Hello,

I am a new user of vagrant. Currently I am trying to launch virtual instance in EC2 using vagrant aws plugin. But after done all the configuration I am getting following error.


$ vagrant up --provider=aws
Bringing machine 'delta' up with 'aws' provider...
==> delta: Warning! The AWS provider doesn't support any of the Vagrant
==> delta: high-level network configurations (`config.vm.network`). They
==> delta: will be silently ignored.
==> delta: Launching an instance with the following settings...
==> delta:  -- Type: t2.micro
==> delta:  -- AMI: ami-a7fdfee2
==> delta:  -- Region: us-east-1
==> delta:  -- Keypair: pratip.pem
==> delta:  -- Block Device Mapping: []
==> delta:  -- Terminate On Shutdown: false
==> delta:  -- Monitoring: false
==> delta:  -- EBS optimized: false
==> delta:  -- Assigning a public IP address in a VPC: false
There was an error talking to AWS. The error message is shown
below:

VPCIdNotSpecified => No default VPC for this user



My Vagrantfile entry is as following:

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define :delta do |x|
    x.vm.box = "hashicorp/precise64"
    x.vm.hostname = "delta"

    x.vm.provider :virtualbox do |v|
      v.name = "delta"
    end

    x.vm.provider :aws do |aws, override|
      aws.access_key_id = ENV['AWS_ACCESS_KEY']
      aws.secret_access_key = ENV['AWS_SECRET_KEY']
      aws.keypair_name = ENV['AWS_KEYNAME']
      aws.ami = "ami-a7fdfee2"
      aws.region = "us-east-1"
      aws.instance_type = "t2.micro"
      override.vm.box = "dummy"
      override.ssh.username = "ubuntu"
      override.ssh.private_key_path = ENV['AWS_KEYPATH']
    end
  end
end




In my AWS account there is one VPC exist named as "test" and it is not a default VPC in my account.

Can anyone guide me how I specify my VPC ID in the vagrantfile?



Regards,
Pratip

Alvaro Miranda Aguilera

unread,
Sep 8, 2015, 3:43:12 AM9/8/15
to vagra...@googlegroups.com
Hello

Can you check this past issue? There is a Vagrantfile with plenty of
options for network

https://github.com/mitchellh/vagrant-aws/issues/114

Thanks
> --
> 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/95d8e71e-d569-49c0-b4e3-89e4e1e61daf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Pratip Ghosh

unread,
Sep 8, 2015, 5:09:55 AM9/8/15
to Vagrant
Hello Alvaro,

Thank you for your help.

I have resolved the issue with adding aws.subnet_id value in my Vagrantfile.

Now another issue I am facing.

As I am not connected my VPC using VPN so I need to assign a Public IP through vagrantfile.


Regards,
Pratip

Pratip Ghosh

unread,
Sep 8, 2015, 5:41:30 AM9/8/15
to Vagrant
Hello

I have found the syntax to assign private and elastic IP address to the new ec2 instance.

  • private_ip_address - The private IP address to assign to an instance within a VPC

elastic_ip - Can be set to 'true', or to an existing Elastic IP address. If true, allocate a new Elastic IP address to the instance. If set to an existing Elastic IP address, assign the address to the instance.

I want to assign public IP to the new ec2 instance which is not persistent IP. Is it possible through vagrantfile?


Regards,
Pratip

Alvaro Miranda Aguilera

unread,
Sep 8, 2015, 7:15:43 AM9/8/15
to vagra...@googlegroups.com
Hello,

Can you test what happen after reload and destroy?

In some cloud providers you get the same IP (like Digital Ocean), but
not sure in AWS as in some cloud provider you can't control that part.

Thanks
Alvaro.
> https://groups.google.com/d/msgid/vagrant-up/cf3787a2-107a-4d3f-9f0f-f2eff0024ec9%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages