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. Moreover, I would prefer not to assume that the limit is default because some of the AWS accounts at our company applied for the higher limit.
Is there any workaround to solve that issue?