When an AI feature slows down, start by separating traffic, latency, and errors. Amazon Bedrock sends runtime metrics to CloudWatch so you can see whether the service accepted more requests, took longer to finish them, or began throttling calls. This walkthrough reads the service metrics and adds an alarm for a sandbox workload without collecting prompt or response content.
Choose the right namespace
- Use AWS CLI v2, a sandbox account with recent traffic through the
bedrock-runtimeendpoint, and the Region where the application sends its requests. - Use a role that can list and read CloudWatch metrics. The optional alarm also needs permission to create, inspect, and delete a CloudWatch alarm.
- For calls to
bedrock-runtime, queryAWS/Bedrock. If your application uses the separatebedrock-mantleendpoint, use that endpoint’s namespace and metrics instead. Amazon Bedrock runtime metrics · Metrics for the bedrock-mantle endpoint.
Read traffic and throttles together
The commands use a 60-minute UTC window and GNU date on Linux. An invocation counts a request Bedrock accepted for processing, including some requests that later fail. Throttled requests appear separately, so the invocation count alone misses part of the demand. Query without a model dimension to include signals that Bedrock could not attribute to a model.
REGION=us-east-1
END=$(date -u +%Y-%m-%dT%H:%M:%SZ)
START=$(date -u -d '60 minutes ago' +%Y-%m-%dT%H:%M:%SZ)
for METRIC in Invocations InvocationThrottles InvocationServerErrors; do
printf '\n%s\n' "$METRIC"
aws cloudwatch get-metric-statistics --region "$REGION" \
--namespace AWS/Bedrock --metric-name "$METRIC" \
--start-time "$START" --end-time "$END" --period 300 \
--statistics Sum \
--query 'sort_by(Datapoints,&Timestamp)[].{Time:Timestamp,Count:Sum}'
done
Read latency alongside request volume. In the same command, substitute InvocationLatency and change Sum to Average in both the statistic argument and the query. The result is in milliseconds. For streaming applications, look at TimeToFirstToken separately so that a slow start and a long response are easier to distinguish. CloudWatch statistics CLI reference.
Identify a model when diagnosing a change
aws cloudwatch list-metrics --region "$REGION" \
--namespace AWS/Bedrock --metric-name Invocations \
--dimensions Name=ModelId --query 'Metrics[].Dimensions'
To inspect a model, copy its published ModelId value and add --dimensions Name=ModelId,Value=YOUR_MODEL_ID to the statistics request. If the listing contains both a model-only series and a model plus ContextWindow series, use the model-only series for the model total. Adding those series would count the subset twice. A newly published time series can take time to appear in the list. CloudWatch metric discovery behavior.
Add and verify a sandbox throttle alarm
This example flags five or more throttles in two of three five-minute periods. Those values are a starting point for the lab. Tune production thresholds to the workload’s usual volume and retry pattern. Missing data is treated as non-breaching here so normal idle periods stay quiet. Use a separate health signal to detect unexpectedly absent traffic.
ALARM="techmandra-bedrock-throttles-$(date -u +%Y%m%d%H%M%S)-$$"
aws cloudwatch put-metric-alarm --region "$REGION" \
--alarm-name "$ALARM" --namespace AWS/Bedrock --metric-name InvocationThrottles \
--statistic Sum --period 300 --evaluation-periods 3 --datapoints-to-alarm 2 \
--threshold 5 --comparison-operator GreaterThanOrEqualToThreshold \
--treat-missing-data notBreaching
aws cloudwatch describe-alarms --region "$REGION" --alarm-names "$ALARM" \
--query 'MetricAlarms[0].{Metric:MetricName,State:StateValue,Threshold:Threshold,Period:Period,Actions:AlarmActions}'
Confirm the name, metric, and threshold in the result. This alarm records state changes without sending notifications. Connect a team’s approved destination only after agreeing who investigates and what to check. Using Amazon CloudWatch alarms.
Troubleshoot and remove the lab alarm
- No datapoints. Confirm the endpoint, Region, account, sample time window, and exact dimension combination. An empty period may mean no traffic.
- Throttles increase. Compare request and token patterns against the workload’s quotas and retry configuration. Track application requests as well, since retries can change how many throttles the service records.
- Latency rises without more throttles. Check whether output lengths changed. Give streaming clients a separate first-token latency signal.
CloudWatch alarms incur charges under the applicable pricing. Remove the lab alarm once you have reviewed its configuration. CloudWatch pricing.
aws cloudwatch delete-alarms --region "$REGION" --alarm-names "$ALARM"






Leave a Reply