> For the complete documentation index, see [llms.txt](https://docs.pagerly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagerly.io/sre-ai-agent/data-sources/cloudwatch.md).

# CloudWatch

## What the Agent Can Do

* Query CloudWatch Logs using filter patterns
* Get CloudWatch metrics — CPU, memory, request count, error rates
* List log groups and metric namespaces
* Search across multiple log groups simultaneously

## Setup Instructions

1. Log into your **AWS console**
2. Go to **IAM** > **Users** > select or create a user
3. Attach the **CloudWatchReadOnlyAccess** policy
4. Go to **Security credentials** tab > **Create access key**
5. Copy the Access Key ID and Secret Access Key

## Required Credentials

| Field                       | Description                                     | Example           |
| --------------------------- | ----------------------------------------------- | ----------------- |
| **AWS Access Key ID**       | IAM access key with CloudWatch read permissions | `AKIA...`         |
| **AWS Secret Access Key**   | IAM secret access key                           | `your-secret-key` |
| **AWS Region** *(optional)* | Default region for API calls                    | `us-east-1`       |

## Context Prompt Tips

> *"Our Lambda logs are in /aws/lambda/api-handler. Production is in us-east-1. Error logs contain level=ERROR."*

## Docs

* [Amazon CloudWatch Documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/)
