Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API for checking EC2 instance limit?

I use extensively EC2 instances for testing distributed system. Unfortunately, sometimes I hit the limit of running instances which cause the whole deployment to fail. I catch the appropriate exception, but I would prefer to avoid the whole deployment rather than failing after launching several instances. To avoid that kind of situation I would like to have a preflight check:

number_of_running_instances + number_of_required_instances <= instance_limit

I could easily check number_of_running_instances and number_of_required_instances, but I couldn't find an API for checking instance_limit. Even worse, AWS support claims that there is no customer visible api for that:

https://forums.aws.amazon.com/message.jspa?messageID=296314

Moreover, I would prefer not to assume that the limit is default, because some of the AWS accounts at our company applied for higher limit.

Is there any workaround to solve that issue?

like image 201
Jakozaur Avatar asked Dec 06 '22 10:12

Jakozaur


2 Answers

FYI, it is possible to query your AWS account limits, see: http://alestic.com/2013/12/ec2-account-attributes

like image 142
ogrodnek Avatar answered Jan 03 '23 07:01

ogrodnek


You can use amazon describe-account-attributes to get the limits on the aws account.

"aws ec2 describe-account-attributes"

like image 25
Shibashis Avatar answered Jan 03 '23 08:01

Shibashis