Search code examples
amazon-ec2vagrantcloudvagrantfilequota

How to deal with InstanceLimitExceeded for EC2 instances?


I'm using vagrant to run multiple AWS EC2 instances in parallel, however I've hit the default limit of 20 instances per region (t2.small in us-east-1):

There was an error talking to AWS.

InstanceLimitExceeded => Your quota allows for 0 more running instance(s). You requested at least 1

Reading troubleshooting page, it's suggested that I should contact AWS support and create a case to ask for a higher limit (which I did and I'm waiting for the response).

EC2 Service Limits: AWS sets limits for these resources on a per-region basis.

However is there any other workaround for such limitation in terms of scaling?

In other words, if there is a limit per region, is there any way of dynamically assign a different region or type of instance to workaround the limitation?


I'm using vagrant-aws vagrant plugin with the following AWS settings in my Vagrantfile:

config.vm.provider :aws do |aws, override|
    aws.ami = "ami-fce3c696"
    aws.instance_type = "t2.small"
    aws.keypair_name = keypair_name
    aws.region = "us-east-1"
    aws.terminate_on_shutdown = true
    if private_key then override.ssh.private_key_path = private_key end
    if security_group then aws.security_groups = [ security_group ] end
    if subnet_id then aws.subnet_id = subnet_id end
    override.nfs.functional = false
    override.ssh.username = "ubuntu"
    override.vm.box = "my_test"
    override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
end

Solution

  • No, you cannot "borrow" from limits in other regions. You could create another account, but then you'd have to deal with the additional administrative overhead of enabling shared access of resources across the accounts. Also note the limits are per instance type. You could try using a different instance type.

    In the future, since the turnaround for limit increases can be a couple days, and varies by type of limit increase, be sure to plan ahead. Especially for lower-tier support contracts, they do not consider limit increase requests to be emergencies.