quota-health.md

Created about 13 hours ago

attributes
source_pathreferences/quota-health.md
source_sha25610f7133d9d3f45ba60c89c1750bb5e31e2e45d8dc7437a69dde11a0efa2e119c
source_urlhttps://github.com/aws/agent-toolkit-for-aws/blob/903433d67cc4eeab334355620373f33a0c162dd4/skills/core-skills/amazon-bedrock/references/quota-health.md
supporting_skill_id40201
upstream_revision903433d67cc4eeab334355620373f33a0c162dd4

Bedrock Quota Health Check

Monitor and manage Bedrock model quotas to prevent throttling. Bedrock enforces per-model, per-region token quotas (TPM/TPD); some models also have a requests-per-minute (RPM) quota, but not all (e.g., Claude Opus 4.7/4.8 have no RPM quota and are governed solely by token-based quotas).

Table of Contents

How Quota Reservation Works

Bedrock reserves TPM quota at request start based on: Total input tokens + maxTokens (i.e., InputTokenCount + CacheWriteInputTokens + maxTokens). If maxTokens is unset, it defaults to the model's maximum (up to 64K–128K), reserving far more quota than needed.

Example (Claude Sonnet, 2M TPM quota):

  • maxTokens=1000, 500 input tokens: reserves 1,500 → ~1,333 concurrent requests
  • maxTokens unset (defaults to 64K): reserves ~64,500 → ~31 concurrent requests

This is the most common cause of unexpected ThrottlingException. Always set maxTokens explicitly.

Cache read tokens (CacheReadInputTokens) are NOT counted toward your TPM quota at all — they don't contribute to the reservation calculation. Prompt caching therefore effectively increases your usable TPM capacity. At settlement, consumption is InputTokenCount + CacheWriteInputTokens + (OutputTokenCount × burndown rate).

Audit Workflow

1. Check Current Quotas

aws service-quotas list-service-quotas --service-code bedrock --region <REGION> --profile <PROFILE> --query "Quotas[?contains(QuotaName, 'tokens per minute')].{Name:QuotaName, Value:Value}" --output table

2. Check Recent Usage vs Limits

Run the quota health script:

python3 scripts/check-quota-health.py --region <REGION> --profile <PROFILE>

The script compares current quota limits against peak CloudWatch metrics over the last 24 hours and flags models approaching their limits.

3. Assess maxTokens Impact

Review application code for Bedrock calls without explicit maxTokens. Each unset call wastes quota proportional to the model's max output tokens.

CloudWatch Metrics

Key metrics in the AWS/Bedrock namespace (dimension: ModelId):

Metric What It Tells You
Invocations RPM usage — compare against RPM quota
InvocationThrottles Throttled requests — any value > 0 needs attention
InputTokenCount Input token consumption per request
OutputTokenCount Actual output tokens — use to right-size maxTokens
InvocationLatency Latency distribution — spikes may correlate with throttling

Sample CloudWatch Logs Insights query (requires model invocation logging enabled):

fields @timestamp, @message
| filter modelId like /claude/
| stats count() as requests, sum(inputTokenCount) as totalInput, sum(outputTokenCount) as totalOutput by bin(1m)
| sort @timestamp desc

When You're Being Throttled

Decision table for resolving ThrottlingException:

Situation Action
maxTokens not explicitly set Set it to expected output length — biggest single impact
Traffic is bursty Use cross-region inference profiles (us., eu., global. prefix) to distribute across regions
Steady-state traffic exceeds quota Request a quota increase (see below)
Latency-sensitive workload Use priority service tier for preferential processing
Non-time-critical workload Use flex service tier (may queue during peak, lower cost)
Consistent high-volume Request quota increase + use cross-region inference for headroom

Quota Increase Requests

aws service-quotas request-service-quota-increase --service-code bedrock --quota-code <QUOTA_CODE> --desired-value <VALUE> --region <REGION> --profile <PROFILE>

To find the quota code for a specific model:

aws service-quotas list-service-quotas --service-code bedrock --region <REGION> --profile <PROFILE> --query "Quotas[?contains(QuotaName, '<MODEL_NAME>')].{Code:QuotaCode, Name:QuotaName, Value:Value}"

Quota increases are reviewed by AWS — plan 1–3 business days. For urgent production needs, open an AWS Support case.

Children

No children yet.

Like how this is organised?

Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.