Proactively Monitor LLM Availability and Latency on Amazon Bedrock Using Amazon CloudWatch
In this post, we’ll walk you through how to build a proactive monitoring solution for Amazon Bedrock using Amazon CloudWatch composite alarms. The solution monitors two key signals: TimeToFirstToken (TTFT) for latency and InvocationServerErrors for availability. When either signal breaches its threshold, a CloudWatch composite alarm triggers an Amazon Simple Notification Service email notification and invokes an AWS Lambda function that posts an alert in an engineering Slack channel.
As enterprises scale generative AI applications built on Amazon Bedrock into production, proactive observability is just as critical as the models themselves. Degraded model response times or a sudden spike in service errors directly affects end-user experience. For latency-sensitive workloads such as conversational assistants, coding tools, or real-time content generation, even a few seconds of additional delay is noticeable. When a model or the underlying service becomes unavailable, lack of automated detection means your engineering team discovers only after customers start complaining.
In this post, we’ll walk you through how to build a proactive monitoring solution for Amazon Bedrock using Amazon CloudWatch composite alarms. The solution monitors two key signals: TimeToFirstToken (TTFT) for latency and InvocationServerErrors for availability. When either signal breaches its threshold, a CloudWatch composite alarm triggers an Amazon Simple Notification Service email notification and invokes an AWS Lambda function that posts an alert in an engineering Slack channel. This gives your team the visibility to act quickly, including routing traffic to a secondary fallback model before end customers are significantly impacted. You can extend this solution to monitor other CloudWatch metrics as relevant for your use case.
Solution Overview
The solution uses a CloudWatch composite alarm named CWAlarmp90ttft that groups two child alarms:
1. Latency alarm - monitors the p90 TimeToFirstToken metric in the AWS/Bedrock CloudWatch namespace. The TimeToFirstToken (TTFT) measures the server-side time from when Amazon Bedrock receives a streaming inference request to when the first response token is returned. It is emitted for the ConverseStream and InvokeModelWithResponseStream API operations. Monitoring at the 90th percentile (p90) ensures you detect degradation that affects a meaningful portion of your users, while avoiding noise from rare outliers.
2. Availability alarm - monitors the InvocationServerErrors metric, which counts AWS server-side errors (HTTP 5xx responses) for your Bedrock model. A spike in server errors signals potential model or service unavailability.
The composite alarm fires when either child alarm is in ALARM state. When it fires, two alarm actions trigger in parallel:
· An SNS topic sends an email notification to the on-call engineering team.
· A Lambda function (TriggerCWBedrockAlarm) publishes a formatted alert to a Slack channel monitored by the engineering team.

The solution workflow is as follows:
1. Your application invokes a Bedrock streaming API (ConverseStream or InvokeModelWithResponseStream). Amazon Bedrock automatically publishes TimeToFirstToken and InvocationServerErrors metrics to the AWS/Bedrock CloudWatch namespace, filtered by the ModelId dimension.
2. The two CloudWatch child alarms continuously evaluate the metrics against their configured thresholds. Each alarm uses an M-of-N evaluation window to reduce false positives from transient spikes.
3. When either child alarm enters ALARM state, the composite alarm CWAlarmp90ttft transitions to ALARM state and fires its alarm actions.
4. Amazon SNS sends an email notification to the subscribed engineering team address.
5. CloudWatch directly invokes the TriggerCWBedrockAlarm Lambda function, which formats the alarm details and posts the message to the configured Slack channel.
6. The engineering team reviews the Slack alert and, if necessary, updates the application to route requests to a secondary Bedrock model until the primary model recovers.
Prerequisites
The following prerequisites are necessary to continue with this post:
1. If you don't already have an AWS account, your first step is to create and activate one.
2. Your application must be invoking Amazon Bedrock using the streaming APIs - ConverseStream or InvokeModelWithResponseStream - for the TimeToFirstToken metric to be emitted. Non-streaming API calls (Converse, InvokeModel) do not produce TTFT data.
4. A basic understanding of Amazon CloudWatch and Amazon Bedrock service.
5. The AWS Command Line Interface (AWS CLI) installed and configured with credentials that have permissions to create CloudWatch alarms, SNS topics, and Lambda permissions in your AWS account.
6. The ModelId of the Amazon Bedrock model you want to monitor. You can find this in the Amazon Bedrock console under Model catalog.
7. This solution integrates with Slack and posts Alarm messages to a Slack channel for proactive monitoring. We use Slack Webhook to post these messages. Slack integration is optional. In case you want to use this integration, create a Slack Webhook using this link as per your company policy.
Deploy the solution
We’ve provided a CloudFormation template (`bedrock-monitoring-composite-alarm.yaml`) that creates all the resources for this solution. The template exposes parameters so you can tune the thresholds and evaluation window to match your workload's baseline. Change the default Parameter values based on your use case and benchmarks for the model which you want to monitor. Before deploying, establish a TTFT baseline for your model by observing TimeToFirstToken p90 over a representative traffic period using CloudWatch Metrics Insights or a CloudWatch dashboard.
AWSTemplateFormatVersion: '2010-09-09'
Description: >
Monitors Amazon Bedrock model availability and latency using a CloudWatch
Composite Alarm (CWAlarmp90ttft). The composite alarm groups two child alarms —
one for p90 Time To First Token (latency) and one for InvocationServerErrors
(availability). When either child alarm triggers, the composite alarm publishes
to an SNS topic for email notification and invokes the TriggerCWBedrockAlarm
Lambda function, which forwards the alert to an engineering Slack channel.
Parameters:
BedrockModelId:
Type: String
Description: >
The Amazon Bedrock ModelId dimension to monitor (e.g.,
us.anthropic.claude-sonnet-4-6). This must exactly match
the ModelId dimension value emitted to the AWS/Bedrock CloudWatch namespace.
Default: "us.anthropic.claude-sonnet-4-6"
TTFTAlarmThresholdMs:
Type: Number
Description: >
P90 Time To First Token threshold in milliseconds. When the p90 TTFT
exceeds this value the latency child alarm enters ALARM state.
TimeToFirstToken is published only for streaming API operations
(ConverseStream / InvokeModelWithResponseStream).
Default: 5000
MinValue: 1000
ServerErrorThreshold:
Type: Number
Description: >
Minimum number of InvocationServerErrors (Sum) within one evaluation
period that triggers the availability child alarm.
Default: 15
MinValue: 1
AlarmEvaluationPeriodSeconds:
Type: Number
Description: >
Length of each CloudWatch alarm evaluation period in seconds.
Must be a multiple of 60. Common values: 60, 300, 600, 900.
Default: 300
AllowedValues: [60, 300, 600, 900, 1800, 3600]
EvaluationPeriods:
Type: Number
Description: >
Total number of evaluation periods considered for the M-of-N alarm
evaluation (the N value). The alarm transitions to ALARM state when
DatapointsToAlarm out of EvaluationPeriods periods breach the threshold.
Default: 5
MinValue: 1
MaxValue: 60
DatapointsToAlarm:
Type: Number
Description: >
Number of breaching datapoints within EvaluationPeriods required to
transition the alarm to ALARM state (the M value).
Default: 3
MinValue: 1
MaxValue: 60
NotificationEmail:
Type: String
Description: Email address to subscribe to the SNS topic for alarm notifications.
AllowedPattern: "^[\\w\\-\\.]+@([\\w\\-]+\\.)+[\\w\\-]{2,}$"
ConstraintDescription: Must be a valid email address.
SlackLambdaFunctionName:
Type: String
Description: >
Name for the Lambda function that relays CloudWatch alarm notifications
to the Slack channel monitored by the engineering team. This function
will be created and managed by this CloudFormation stack.
Default: "TriggerCWBedrockAlarm"
# ---------------------------------------------------------------------------
# Slack Integration Parameters
#
# IMPORTANT: Both parameters below MUST be provided for Slack notifications
# to work. Leave them blank only if you do not need Slack integration and
# will use email-only (SNS) notifications.
# ---------------------------------------------------------------------------
SlackWebhookUrl:
Type: String
Description: >
REQUIRED FOR SLACK INTEGRATION — Incoming Webhook URL for the Slack channel
that should receive alarm notifications. Obtain this from your Slack workspace
under Apps → Incoming Webhooks (https://api.slack.com/messaging/webhooks).
Format: https://hooks.slack.com/services/TXXXXXXX/BXXXXXXX/XXXXXXXX
Leave blank to disable Slack notifications (email-only via SNS will still work).
Default: ""
NoEcho: true
SlackCCUsers:
Type: String
Description: >
REQUIRED FOR SLACK USER MENTIONS — Comma-separated list of Slack Member IDs
to @-mention in alarm notifications (e.g., U01ABC123,U02DEF456).
Find a member's ID in Slack: click their profile → "More" (three-dot menu)
→ "Copy member ID".
Leave blank to send alarm messages without any user mentions.
Default: ""
Resources:
# -----------------------------------------------------------------------
# IAM Role – execution role for the Slack notification Lambda function
# -----------------------------------------------------------------------
SlackLambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub "${SlackLambdaFunctionName}-cfn-role"
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
# Grants permission to write logs to CloudWatch Logs
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Tags:
- Key: Purpose
Value: BedrockMonitoring
- Key: ManagedBy
Value: CloudFormation
# -----------------------------------------------------------------------
# Lambda Function – forwards CloudWatch alarm events to Slack
#
# Environment variables:
# SLACK_WEBHOOK_URL – Incoming Webhook URL (set via SlackWebhookUrl param)
# SLACK_CC_USERS – Comma-separated Slack Member IDs to @-mention
# (set via SlackCCUsers param)
#
# NOTE: Both env vars must be populated for Slack integration to work.
# See parameter descriptions above for how to obtain the required values.
# -----------------------------------------------------------------------
SlackLambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: !Ref SlackLambdaFunctionName
Description: >
Receives CloudWatch composite alarm events and forwards formatted
notifications to a Slack channel via Incoming Webhook. Requires
SLACK_WEBHOOK_URL and SLACK_CC_USERS environment variables to be set.
Runtime: python3.12
Architectures:
- arm64
Handler: index.lambda_handler
Role: !GetAtt SlackLambdaExecutionRole.Arn
Timeout: 180
MemorySize: 128
Environment:
Variables:
# SLACK_WEBHOOK_URL: Incoming Webhook URL for the target Slack channel.
# Must be set to a valid https://hooks.slack.com/... URL for Slack
# notifications to work. Provide via the SlackWebhookUrl parameter.
SLACK_WEBHOOK_URL: !Ref SlackWebhookUrl
# SLACK_CC_USERS: Comma-separated Slack Member IDs (e.g. U01ABC,U02DEF).
# When set, these users will be @-mentioned in every alarm message.
# Provide via the SlackCCUsers parameter.
SLACK_CC_USERS: !Ref SlackCCUsers
Code:
ZipFile: |
import json
import os
import urllib.request
SLACK_WEBHOOK_URL = os.environ["SLACK_WEBHOOK_URL"]
SLACK_CC_USERS = os.environ.get("SLACK_CC_USERS", "")
def lambda_handler(event, context):
print(json.dumps(event))
# Handle direct CloudWatch Alarm Lambda action format
alarm_name = event.get("alarmData", {}).get("alarmName", "Unknown Alarm")
state = event.get("alarmData", {}).get("state", {})
config = event.get("alarmData", {}).get("configuration", {})
metrics = config.get("metrics", [{}])
metric_info = metrics[0].get("metricStat", {}).get("metric", {}) if metrics else {}
color = "#d63f3f" if state.get("value") == "ALARM" else "#36a64f"
cc_mentions = " ".join(
f"<@{uid.strip()}>" for uid in SLACK_CC_USERS.split(",") if uid.strip()
)
payload = {
"attachments": [{
"color": color,
"title": f":rotating_light: {alarm_name}",
"fields": [
{"title": "Status", "value": state.get("value", "N/A"), "short": True},
{"title": "Region", "value": event.get("region", "N/A"), "short": True},
{"title": "Namespace", "value": metric_info.get("namespace", "N/A"), "short": True},
{"title": "Metric", "value": metric_info.get("name", "N/A"), "short": True},
{"title": "Reason", "value": state.get("reason", "N/A"), "short": False},
{"title": "CC", "value": cc_mentions, "short": False},
],
}]
}
if not SLACK_WEBHOOK_URL:
print("SLACK_WEBHOOK_URL is not set — skipping Slack notification")
return {"statusCode": 200}
req = urllib.request.Request(
SLACK_WEBHOOK_URL,
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json"},
)
urllib.request.urlopen(req)
return {"statusCode": 200}
Tags:
- Key: Purpose
Value: BedrockMonitoring
- Key: ManagedBy
Value: CloudFormation
# -----------------------------------------------------------------------
# Lambda permission – allow CloudWatch composite alarm to invoke the
# SlackLambdaFunction directly via alarm action.
# -----------------------------------------------------------------------
SlackLambdaInvokePermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !Ref SlackLambdaFunction
Action: lambda:InvokeFunction
Principal: lambda.alarms.cloudwatch.amazonaws.com
SourceAccount: !Ref AWS::AccountId
# -----------------------------------------------------------------------
# SNS Topic – email notification when the composite alarm fires
# -----------------------------------------------------------------------
BedrockAlarmSNSTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: BedrockModelAlarmNotifications
DisplayName: "Amazon Bedrock Model Alarm"
Tags:
- Key: Purpose
Value: BedrockMonitoring
- Key: ManagedBy
Value: CloudFormation
BedrockAlarmEmailSubscription:
Type: AWS::SNS::Subscription
Properties:
TopicArn: !Ref BedrockAlarmSNSTopic
Protocol: email
Endpoint: !Ref NotificationEmail
# -----------------------------------------------------------------------
# Child Alarm 1: P90 Time To First Token (latency signal)
#
# TimeToFirstToken is emitted only when using the streaming APIs:
# ConverseStream | InvokeModelWithResponseStream
# Namespace: AWS/Bedrock
# Dimension: ModelId
# Statistic: p90 (requires extended statistics; specify as "p90")
# -----------------------------------------------------------------------
BedrockTTFTAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: !Sub "Bedrock-p90-TTFT-High-${BedrockModelId}"
AlarmDescription: !Sub >
P90 TimeToFirstToken for Bedrock model ${BedrockModelId} exceeded
${TTFTAlarmThresholdMs} ms. Elevated TTFT indicates latency degradation
for streaming inference requests, impacting perceived responsiveness.
Namespace: AWS/Bedrock
MetricName: TimeToFirstToken
Dimensions:
- Name: ModelId
Value: !Ref BedrockModelId
ExtendedStatistic: p90
Period: !Ref AlarmEvaluationPeriodSeconds
EvaluationPeriods: !Ref EvaluationPeriods
DatapointsToAlarm: !Ref DatapointsToAlarm
Threshold: !Ref TTFTAlarmThresholdMs
ComparisonOperator: GreaterThanThreshold
TreatMissingData: notBreaching
Tags:
- Key: Purpose
Value: BedrockMonitoring
# -----------------------------------------------------------------------
# Child Alarm 2: InvocationServerErrors (availability / service error signal)
#
# InvocationServerErrors counts requests that resulted in AWS server-side
# errors (HTTP 5xx from the Bedrock service), indicating model or service
# unavailability. Namespace: AWS/Bedrock | Dimension: ModelId
# -----------------------------------------------------------------------
BedrockServerErrorAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: !Sub "Bedrock-InvocationServerErrors-High-${BedrockModelId}"
AlarmDescription: !Sub >
InvocationServerErrors for Bedrock model ${BedrockModelId} reached or
exceeded ${ServerErrorThreshold} errors. Server-side errors indicate
AWS service issues or model unavailability.
Namespace: AWS/Bedrock
MetricName: InvocationServerErrors
Dimensions:
- Name: ModelId
Value: !Ref BedrockModelId
Statistic: Sum
Period: !Ref AlarmEvaluationPeriodSeconds
EvaluationPeriods: !Ref EvaluationPeriods
DatapointsToAlarm: !Ref DatapointsToAlarm
Threshold: !Ref ServerErrorThreshold
ComparisonOperator: GreaterThanOrEqualToThreshold
TreatMissingData: notBreaching
Tags:
- Key: Purpose
Value: BedrockMonitoring
# -----------------------------------------------------------------------
# Composite Alarm: CWAlarmp90ttft
#
# Alarm rule: fires when EITHER child alarm is in ALARM state.
# ALARM(TTFT child) OR ALARM(ServerError child)
#
# Actions (on ALARM):
# 1. Publish to BedrockAlarmSNSTopic → email notification
# 2. Invoke SlackLambdaFunction → Slack notification
#
# OK actions:
# 1. Publish to BedrockAlarmSNSTopic → recovery email
# -----------------------------------------------------------------------
CWAlarmp90ttft:
Type: AWS::CloudWatch::CompositeAlarm
DependsOn:
- BedrockTTFTAlarm
- BedrockServerErrorAlarm
- SlackLambdaInvokePermission
Properties:
AlarmName: CWAlarmp90ttft
AlarmDescription: >
Composite Amazon Bedrock monitoring alarm. Triggers when p90 Time To
First Token exceeds the latency threshold (high latency) OR when
InvocationServerErrors exceed the error threshold (model/service
unavailability). On alarm, sends email via SNS and notifies the
engineering Slack channel via the TriggerCWBedrockAlarm Lambda function.
Consider routing traffic to a secondary/fallback Bedrock model when
this alarm is in ALARM state.
AlarmRule: !Sub 'ALARM("Bedrock-p90-TTFT-High-${BedrockModelId}") OR ALARM("Bedrock-InvocationServerErrors-High-${BedrockModelId}")'
AlarmActions:
- !Ref BedrockAlarmSNSTopic
- !GetAtt SlackLambdaFunction.Arn
OKActions:
- !Ref BedrockAlarmSNSTopic
ActionsEnabled: true
Tags:
- Key: Purpose
Value: BedrockMonitoring
- Key: ManagedBy
Value: CloudFormation
Outputs:
CompositeAlarmName:
Description: Name of the CloudWatch composite alarm
Value: !Ref CWAlarmp90ttft
Export:
Name: !Sub "${AWS::StackName}-CompositeAlarmName"
CompositeAlarmArn:
Description: ARN of the CloudWatch composite alarm
Value: !Sub "arn:aws:cloudwatch:${AWS::Region}:${AWS::AccountId}:alarm:CWAlarmp90ttft"
Export:
Name: !Sub "${AWS::StackName}-CompositeAlarmArn"
TTFTChildAlarmName:
Description: Name of the p90 TTFT latency child alarm
Value: !Ref BedrockTTFTAlarm
Export:
Name: !Sub "${AWS::StackName}-TTFTAlarmName"
ServerErrorChildAlarmName:
Description: Name of the InvocationServerErrors availability child alarm
Value: !Ref BedrockServerErrorAlarm
Export:
Name: !Sub "${AWS::StackName}-ServerErrorAlarmName"
SNSTopicArn:
Description: ARN of the SNS topic for alarm email notifications
Value: !Ref BedrockAlarmSNSTopic
Export:
Name: !Sub "${AWS::StackName}-SNSTopicArn"
SlackLambdaFunctionArn:
Description: ARN of the Lambda function that sends Slack notifications
Value: !GetAtt SlackLambdaFunction.Arn
Export:
Name: !Sub "${AWS::StackName}-SlackLambdaArn"
SlackLambdaExecutionRoleArn:
Description: ARN of the IAM execution role for the Slack notification Lambda
Value: !GetAtt SlackLambdaExecutionRole.Arn
Export:
Name: !Sub "${AWS::StackName}-SlackLambdaRoleArn"
DeployCommand:
Description: Example AWS CLI command to deploy this stack
Value: !Sub >
aws cloudformation deploy
--template-file bedrock-monitoring-composite-alarm.yaml
--stack-name bedrock-monitoring
--parameter-overrides
BedrockModelId=us.anthropic.claude-3-5-sonnet-20241022-v2:0
NotificationEmail=your-team@example.com
TTFTAlarmThresholdMs=3000
ServerErrorThreshold=5
SlackLambdaFunctionName=TriggerCWBedrockAlarm
SlackWebhookUrl=https://hooks.slack.com/services/TXXXXXXX/BXXXXXXX/XXXXXXXX
SlackCCUsers=U01ABC123,U02DEF456
--capabilities CAPABILITY_NAMED_IAM
--region us-east-1- Save the above code snippet as "bedrock-monitoring-composite-alarm.yaml" in your local file folder.
- Sign in to your AWS account and select the AWS Region where you want to deploy this.
- Navigate to the CloudFormation service.
- Choose Stacks > Create Stack > With new resources (standard).
- In the Specify template section, choose Upload a template file.
- Choose file, navigate to where you saved the CloudFormation template, and upload it. Then choose Next.
- Specify a stack name for your CloudFormation stack.
- In the parameters section, provide the Notification Email where you want to receive the SNS email notification, SlackCCUsers (single or comma separated) list of Slack account user id and Slack Webhook URL. SlackCCUsers and SlackWebhookUrl are optional parameters which are needed if you plan to use Slack integration. Rest of the parameters are defaulted. Change these based on your use case.
- On the Configure stack options page, specify any further options needed or keep the default options and select the check box to acknowledge that this template will create IAM resources and click Next.
- On the Review and create page, verify the parameters and click Submit.


11. Check the stack creation status. Upon successful completion, the status shows CREATE_COMPLETE.
12. Successful completion will trigger a SNS subscription confirmation email to the email address provided above. Ensure you confirm the subscription by clicking on the link.

Test the solution
Before relying on the solution in production, validate that the full alert path works by temporarily lowering the TTFT threshold to trigger the alarm intentionally.

I am running a sample python script provided below to infer “us.anthropic.claude-sonnet-4-6” model from Bedrock. I am running this script directly from AWS CloudShell . However, you can run it from your local machine as long as you have installed the latest version of AWS CLI and have set up the environment variable s to access your AWS account. Script runs out of us-west-2 region, you can modify the region within the script to the region where you deployed the CloudFormation stack. Replace the MODEL_ID with the model which you are planning to implement.
import boto3
from botocore.exceptions import ClientError
bedrock = boto3.client(service_name='bedrock-runtime', region_name='us-west-2')
MODEL_ID = "us.anthropic.claude-sonnet-4-6"
messages = [
{
"role": "user",
"content": [{"text": "Explain Physics."}]
}
]
try:
response = bedrock.converse_stream(
modelId=MODEL_ID,
messages=messages,
inferenceConfig={"maxTokens": 4000, "temperature": 0.5}
)
print("=== Response ===")
stream = response.get('stream')
if stream:
for event in stream:
if 'contentBlockDelta' in event:
print(event['contentBlockDelta']['delta']['text'], end="", flush=True)
if 'messageStop' in event:
print(f"\n\n=== Stop reason: {event['messageStop']['stopReason']} ===")
if 'metadata' in event:
metadata = event['metadata']
usage = metadata.get('usage', {})
metrics = metadata.get('metrics', {})
print(f"\n=== Metrics ===")
print(f"Region: us-west-2")
print(f"Input tokens: {usage.get('inputTokens')}")
print(f"Output tokens: {usage.get('outputTokens')}")
print(f"Total tokens: {usage.get('totalTokens')}")
print(f"Latency: {metrics.get('latencyMs')} ms")
except ClientError as e:
print(f"Error: {e.response['Error']['Message']}")
Check the inbox of the email address you subscribed to the SNS topic. You should receive an alarm notification email with the alarm name, threshold, and the current metric value that triggered it.

The TriggerCWBedrockAlarm Lambda function should have posted a message to the Slack channel monitored by your engineering team providing the alarm name, state, reason, and timestamp.

After validating the alert flow, restore the original TTFT threshold by redeploying the CloudFormation stack or by updating the alarm directly as seen below

The alarm returns to `OK` state once the metric no longer breaches the restored threshold, and an OK notification is sent to the SNS topic.

Considerations
Keep the following points in mind when using this solution in production:
1. The TimeToFirstToken metric is emitted exclusively when your application uses ConverseStream or InvokeModelWithResponseStream. If you use the non-streaming Converse or InvokeModel APIs, TimeToFirstToken data will not be published and the TTFT child alarm will remain in Insufficient data` state. In that case, consider monitoring InvocationLatency at a percentile statistic as an alternative latency signal.
2. Baseline your thresholds before deploying to production. Default threshold values in the CloudFormation template are starting points only. Monitor TimeToFirstToken p90 for your specific model and traffic patterns over at least one week before finalizing your alert threshold. Set the threshold at approximately 1.5–2x your observed p90 baseline to reduce false positives.
3. M-of-N evaluation reduces false positives. The template defaults to 3-of-5 evaluation (alarm fires only when 3 out of 5 consecutive periods breach the threshold). This prevents a single transient spike from triggering an alert, but it does introduce a detection delay of up to 2 additional evaluation periods. Tune DatapointsToAlarm and EvaluationPeriods to balance sensitivity and noise for your use case.
4. ModelId dimension scoping. Each child alarm is scoped to a specific ModelId. If you use multiple Bedrock models in production (for example, different models for different features or regions, deploy separate stacks or add additional child alarms per model and update the composite alarm rule accordingly.
5. If you use Amazon Bedrock inference profiles , the ModelId dimension in CloudWatch reflects the inference profile ID. Confirm the exact ModelId value being published to CloudWatch using ` aws cloudwatch list-metrics --namespace AWS/Bedrock --region us-west-2 ` before configuring your alarms.
6. You can extend this solution by modifying your inference logic to automatically failover to your back model in case model/service is unavailable based on threshold criteria.
Cleanup
Follow the steps in this section to remove the resources created by this solution.
- Navigate to the CloudFormation console, select the stack that you created, and then choose Delete stack. Upon successful deletion, the resources created by the stack will be deleted.

Conclusion
In this post, we’ve demonstrated how to build proactive monitoring for Amazon Bedrock LLM models using Amazon CloudWatch composite alarms. By combining a p90 `TimeToFirstToken` latency alarm and an `InvocationServerErrors` availability alarm under a single composite alarm, you get a unified alert that covers both performance degradation and model/service unavailability. When the composite alarm fires, your engineering team is notified immediately via email through Amazon SNS and via Slack through the Lambda function, giving them the context they need to assess the situation and route traffic to a secondary model if necessary.
Thank you for reading this post. If you have any comments or questions, feel free to leave them in the comments section. If you have questions about this post, contact AWS Support . You can also start a new thread on Amazon CloudWatch re:Post to get answers from the community.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article