ec2 throttling and batch operations

0

I'd like to understand how batch operation against ec2 count toward throttle limits. Two requests specifically are of interest to me:

  • LaunchFleet using EC2Fleet configuration -- if I'm attempting to start 2,000 instances with a single LaunchFleet request and also apply a tag to each instance on launch (as part of launch fleet configuration), how does this count against the throttle limits? Will only 1,000 be started and then I should wait until the bucket is refilled? What about the tagging of instances on launch, does this constrain things further?
  • TerminateInstances -- similar question. I know that the max number of instances I can terminate in one call is 1,000 but if I make one such call, does the bucket empty and I should wait 1 minute before terminating another batch?

thanks

asked 2 years ago603 views
1 Answer
1

Hello,

I understand you need further clarification on how batch operations against EC2 count toward throttle limit.

Amazon EC2 throttles EC2 API requests for each AWS account on a per-Region basis. Throttling is used to ensure that calls do not exceed the maximum allowed API request limit. If you exceed an API throttling limit, you will get the RequestLimitExceeded error code.

With that being said, if you start more instances than your limit allows, you will either get the error code above or you will have to create a poll. As for tagging your EC2 instances, that does not affect throttling or LaunchFleet. Additional information provided here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/fleet-quotas.html

So, to answer your question, yes only 1,000 instances will be started and you will have to wait until the bucket is refilled to start the next instances. For example, the resource token bucket size for RunInstances is 1000 tokens, and the refill rate is two tokens per second. Therefore, you can immediately launch 1000 instances, using any number of API requests, such as one request for 1000 instances or four requests for 250 instances. After the resource token bucket is empty, you can launch up to two instances every second, using either one request for two instances or two requests for one instance. Please refer to this documentation for additional information: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/throttling.html#throttling-how

Please be advised that you can always request for an increase for API throttling for your AWS account. To request a limit adjustment, please contact the AWS Support Center: https://support.console.aws.amazon.com/support/home#/

You can also use Amazon CloudWatch to monitor and collect metrics around API throttling, or you can set alarms that are triggered when API throttling limits are reached. View this documentation for further guidance on monitoring API requests using Amazon CloudWatch: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/monitor.html

As for terminating your instances, the maximum bucket capacity is 1000 and the bucket refill rate is 20. This means after 1000 instances are terminated, you will be able to terminate a maximum of 20 instances every second. That being said, you can terminate 1000 instances in a single request to delete instance fleet, but you can only delete up to 25 instant fleets in a single request. If that number is exceeded, no instant fleets are deleted and an error is returned. Additional information provided here: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TerminateInstances.htmlhttps://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DeleteFleets.html

Please contact us if you have any further questions, and feel free to reach out to us via a support case to facilitate a discussion on the specifics of your resources: https://console.aws.amazon.com/support/home#/case/create?issueType=technical

Maria_E
answered 2 years ago
AWS
SUPPORT ENGINEER
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions