6

I was following railscasts to use rubber to deploy my rails app to ec2. I got the following problem:

$ cap rubber:create_staging

..... (omit successful part)

/Users/brian/.rvm/gems/ruby-1.9.3-p327/gems/excon-0.25.3/lib/excon/middlewares/expects.rb:10:in `response_call': SecurityGroupLimitExceeded => You have exceeded the number of VPC security groups allowed per instance. (Fog::Compute::AWS::Error)

how can I avoid this problem?

Community
  • 1
  • 1
Brian
  • 30,156
  • 15
  • 86
  • 87

2 Answers2

9

The issue is that by default Rubber is creating different security groups for each role. You will notice the console printing numerous "Creating Security Group #{x}" lines. The max allowed without petitioning is 5 (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html) without petitioning.

First run cap rubber:destroy_all.

To force Rubber to use only one security group go into rubber.yml and set... auto_security_groups: false isolate_security_groups: false

After that it may work, or you may get error saying security groups exists... Go here to read how to access security groups. Once in the panel delete all security groups but "default". http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html#DeleteSecurityGroup

If you are getting errors about rules, then select the "default" user group in the AWS panel . This will bring up the rules. Delete all custom TCP rules. After this everything should work. You may need to repeat deleting groups and rules, since Rubber seems to do a terrible job of managing those.

Carlos Cervantes
  • 1,377
  • 1
  • 10
  • 16
1

You can request the VPC limits for your account to be raised via this form.

Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203
  • I haven't done anything yet (I just created a new aws account for this project). why does my number of VPC exceed the limit? – Brian Aug 08 '13 at 15:45
  • what I wanted to say is I thought it's a bug of rubber, I don't think my VPC really exceed the limit. – Brian Aug 08 '13 at 16:07
  • How many VPCs do you have? These are the limits: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html – Assaf Lavie Aug 09 '13 at 07:46
  • It's something I'm working on now. The problem is traditionally, EC2 and VPC used different APIs. Amazon apparently wanted to start forcing people to use VPC, so all new accounts automatically use VPC, even if using the EC2 Classic API. Existing accounts automatically use VPCs when launching in regions they never used before, otherwise they still use EC2 classic. Rubber was written with EC2 classic in mind. It's a shame Amazon decided to completely break their public, versioned API. But we'll get around it. – nirvdrum Jun 08 '14 at 19:27