How to force-spawn a server in EC2 and not a VPC? (vagrant-aws)

115 views
Skip to first unread message

Benoit

unread,
Jan 17, 2014, 3:54:21 AM1/17/14
to vagra...@googlegroups.com
Hi list,

I'm having troubles figuring out why my Vagrantfile always spawns servers in a VPC on AWS while I don't seem to be specifying anything that "tells" it to.

How can I force EC2 over a VPC? On the other hand, how would I force-spawn a server in a VPC (if I wanted to)? Using a combination of 'private_ip_address', 'security_groups' and 'subnet_id' perhaps?

I'd be grateful if you guys could review the following Vagrantfile I'm using:

https://gist.github.com/saalaa/8470293

Thanks a lot for helping.

Regards.

Rajiv Ranganath

unread,
Jan 17, 2014, 6:12:35 PM1/17/14
to vagra...@googlegroups.com
Hi Benoit,

On Fri, Jan 17, 2014 at 12:54 AM, Benoit <myard...@gmail.com> wrote:

[...]

> I'm having troubles figuring out why my Vagrantfile always spawns
> servers in a VPC on AWS while I don't seem to be specifying anything
> that "tells" it to.
>

This could be because of AWS Default VPC.

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html#detecting-platform

Can you confirm that your account supports EC2-Classic? Otherwise it
could probably be launching the instance in your Default VPC.

> How can I force EC2 over a VPC? On the other hand, how would I force-spawn a
> server in a VPC (if I wanted to)? Using a combination of
> 'private_ip_address', 'security_groups' and 'subnet_id' perhaps?

You'll need to use a combination of,

- security_groups
- subnet_id
- region
- availability_zone
- elastic_ip
- private_ip_address (is optional, but you might need it for other
reasons)

Couple of things to note. In a simple VPC configuration, you'll need
elastic IP so your provisioners can work. Using the subnet_id, region
and availability_zone, the AWS API will figure out the correct VPC (as
long as one exists)

If you are having a slightly advanced VPC configuration, then also look
at how your route tables, network ACLs and bastian hosts are configured.

Best,
Rajiv

Benoit

unread,
Jan 23, 2014, 8:53:56 AM1/23/14
to vagra...@googlegroups.com
Hi,

Thanks for your reply Rajiv. You set me on the correct path.

I must apology though since I should have followed up with AWS more closely than I did. Our company account defaults to VPC deployments so in the end I just set up the Internet Gateway, Elastic IP and Security Groups correctly and it worked just fine.

Thanks a lot!
Reply all
Reply to author
Forward
0 new messages