Lesson 3 of 3 Architecture Patterns

Planning for Service Quotas and Handling Throttling

This lesson explains how account quotas cap resources and API rates, and how to plan for quotas and handle throttling so designs do not fail when they scale or fail over.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify service quotas and how they apply per Region.
  • Explain why a standby environment needs raised quotas.
  • Explain how retries, backoff and buffering handle throttling.

Service quotas

Service quotas, formerly called service limits, are the maximum values for resources and actions in an account, and most apply per Region. Examples include the number of running On-Demand vCPUs for EC2, the number of VPCs per Region and Lambda concurrent executions, which defaults to 1,000 per Region. Most quotas are adjustable, and an increase can be requested in the Service Quotas console or API; some are fixed. The following list describes how quotas are managed.

  • The Service Quotas console shows applied and default values and records increase requests.
  • CloudWatch publishes usage metrics for many quotas, and an alarm can warn before usage reaches the quota.
  • Trusted Advisor service limit checks flag quotas that are close to being reached.
  • Quota request templates in AWS Organizations apply increases automatically to new accounts.
True or false

Service quotas

Exam skills 2.2.3 · 4.4.6

Check how service quotas are managed.

Log in to try this activity Interactive activities are free with an account.

Quotas in a standby environment

The exam guide specifically mentions configuring service quotas for a workload in a standby environment. Because quotas apply per account and per Region, a disaster recovery Region starts with default quotas, even when the primary Region has had increases. A pilot light or warm standby environment that must scale up to full production size during a disaster can fail if, for example, the EC2 vCPU quota or Lambda concurrency quota in that Region is still at its default. The quotas in the recovery Region must therefore be raised in advance to match production, and checked as part of regular disaster recovery tests.

Throttling and how to handle it

Throttling happens when requests exceed an allowed rate, and the service rejects the excess, for example with HTTP 429 Too Many Requests or a ThrottlingException. It protects both AWS services and your own back ends. Architects handle it at two levels: clients retry throttled requests with exponential backoff and jitter, which the AWS SDKs do by default, and designs absorb or limit load before it reaches a constrained component. The following table summarises common throttling controls.

ControlWhat it does
API Gateway throttlingAccount-level and stage or method rate and burst limits; usage plans with API keys set per-client limits
Lambda reserved concurrencyCaps a function's concurrency so it cannot overwhelm a downstream database or API
SQS queue in front of a back endBuffers bursts so consumers process at a steady rate
DynamoDB capacity modesOn-demand absorbs spikes; provisioned capacity with auto scaling suits predictable load
Exponential backoff with jitterSpreads retries out so they do not cause a second spike

The following diagram shows a client retrying with exponential backoff and jitter.

Retrying throttled requests with exponential backoff and jitter. After each rejected request, the client waits about twice as long as before, and a random jitter spreads the retries of many clients apart, so they do not arrive together and cause a second spike. The AWS SDKs do this by default.
The wait times are illustrative. Without jitter, many clients throttled at the same moment would retry at the same moment too.
Match the pairs

Throttling controls

Exam skills 4.4.6

Match each requirement with the throttling control that meets it.

Log in to try this activity Interactive activities are free with an account.
Worked example

A company runs an order API on API Gateway and Lambda in us-east-1, with a warm standby in us-west-2 that runs at 10% of production capacity. During a DR test, the standby failed to scale and returned errors when traffic shifted. Lambda reported throttling. What should the architect change?

The production Region had a raised Lambda concurrency quota, but the standby Region still had the default of 1,000. The architect requests the same concurrency quota, and any other raised quotas such as EC2 vCPUs, in us-west-2 through Service Quotas, and adds CloudWatch alarms on quota usage in both Regions. To protect the database during the surge, the order function receives reserved concurrency sized to the database's connection capacity, and API Gateway throttling returns 429 responses that clients retry with backoff. Future DR tests include a check that quotas in both Regions match.

Check yourself

Why must quotas be checked in a disaster recovery Region before an incident?

Show answer

Quotas are set per Region, so the recovery Region may not allow the instances, IP addresses or concurrency the workload needs. Increases must be requested in advance.

Exam Tips

Remember for the exam

  • Most service quotas apply per account and per Region; many can be increased through Service Quotas.
  • Raise quotas in the DR Region in advance, or a standby environment cannot scale during failover.
  • Alarm on quota usage with CloudWatch, or check Trusted Advisor service limits.
  • Handle throttling with exponential backoff and jitter, and buffer bursts with SQS.
  • Use API Gateway throttling and usage plans, and Lambda reserved concurrency, to protect back ends.