> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/health-sources/cloudwatch.md).

# Cloudwatch

Add AWS CloudWatch as a health source in Harness Continuous Verification to monitor metrics and logs during deployments.

This topic explains how to configure AWS CloudWatch as a health source in Harness Continuous Verification (CV). CloudWatch provides metrics and log data that Harness CV uses to verify deployment health and detect regressions automatically.

***

## What you will learn from this topic

* How to add AWS CloudWatch as a health source in Harness Continuous Verification
* How to configure CloudWatch Metrics with Metrics Insights SQL queries
* How to configure CloudWatch Logs with log group queries and field mapping
* How to assign metrics to services and configure risk profiles

***

## Before you begin

This topic assumes you have completed the prerequisite setup for Continuous Verification. Go to [Configure CV](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/verify-deployments.md) to complete those steps before adding a health source.

***

## Add CloudWatch as a health source

This option is available only if you have configured the service and environment as fixed values.

A health source maps a Harness service to the service in a deployment environment monitored by an APM or logging tool.

To add CloudWatch as a health source, do the following:

1. In **Health Sources**, click **Add**. The **Add New Health Source** settings appear.

   ![Health Sources panel showing the Add button and the Add New Health Source dialog](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-c5e7ecd6b9ab6be58b6a7b82b90de7a66abc801d%2Fverify-deployments-with-cloudwatch-114.png?alt=media)
2. In **Select health source type**, select **CloudWatch**.
3. In **Health Source Name**, enter a name for the health source.
4. Under **Connect Health Source**, click **Select Connector**.
5. In **Connector** settings, choose an existing connector or click **New Connector**. Harness supports AWS connectors with Manual Credentials, IRSA, Assume IAM Role on Delegate, and OIDC credential types. Go to [CloudWatch IAM permissions](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/health-sources/cloudwatch-aws.md) for IAM permissions and trust policy details for each credential type.

   ![Connector selection panel showing the available AWS connector options](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-551f9cb464cb4715a11c6d89f5a57260e5e7df7c%2Fverify-deployments-with-cloudwatch-115.png?alt=media)
6. Click **Apply Selected**. The connector is added to the health source.
7. In **Select Feature**, select the CloudWatch feature to configure:

   * **CloudWatch Metrics**
   * **CloudWatch Logs**

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>CloudWatch Logs feature flag</strong></p><p>CloudWatch Logs requires the feature flag <code>CDS_CV_CLOUDWATCH_LOGS_ENABLED</code>. Contact <a href="mailto:support@harness.io">Harness Support</a> to enable it.</p></div>
8. Click **Next**.

### Configuration

Depending on your feature selection, complete the steps in the corresponding tab.

{% tabs %}
{% tab title="CloudWatch Metrics" %}
To configure CloudWatch Metrics, do the following:

1. Select the **AWS Region**.
2. Click **+ Add Metric**.

   You can customize the metrics to map the Harness service to the monitored environment in the **Query Specifications and Mapping** settings.
3. Enter a name for the metric in **Metric Name**.
4. Enter a name for the group in **Group Name**.
5. Select the services you want to apply to the metric under **Assign**. At least one selection is required.
6. If you select **Continuous Verification** or **Service Health**, configure a risk profile.
7. Enter the query in the **Query** field using [CloudWatch Metrics Insights SQL syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-syntax.html). This field also accepts a Harness expression or runtime input.

   Harness supports the full Metrics Insights query language, including `WHERE` and `ORDER BY` clauses. Use `WHERE` to filter metrics by dimension values, for example, to isolate metrics for a specific ALB target group or EC2 instance. Use `ORDER BY` to sort results when your query returns multiple time series.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Comparing groups with Continuous Verification</strong></p><p>When you use Continuous Verification to compare a control group and a test group (for example, comparing two ALB target groups during a custom blue/green deployment), configure separate metric definitions with <code>WHERE</code> clauses that target each group's dimension values.</p></div>
8. Click **Fetch Records** to retrieve the details.

   ![Query Specifications and Mapping panel showing the Fetch Records button and query results](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-aba387eaf7bc2893666c425eca4c7b1870a84046%2Fverify-deployments-with-cloudwatch-116.png?alt=media)
9. Click **Submit**. The health source is displayed in the AI Verify (v1) step.

   ![AI Verify (v1) step showing the CloudWatch Metrics health source added successfully](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-c5fb7f7fd640c26e353554c770dd8a2c27ce7694%2Fverify-deployments-with-cloudwatch-117.png?alt=media)
   {% endtab %}

{% tab title="CloudWatch Logs" %}
{% hint style="info" %}
**CloudWatch Logs feature flag**

CloudWatch Logs requires the feature flag `CDS_CV_CLOUDWATCH_LOGS_ENABLED`. Contact [Harness Support](mailto:support@harness.io) to enable it.
{% endhint %}

{% hint style="info" %}
**Prerequisites and permissions**

For prerequisites, configuration steps, and permissions required for CloudWatch Logs, go to [CloudWatch Logs](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/health-sources/cloudwatch-aws.md).
{% endhint %}

To configure CloudWatch Logs, do the following:

1. Click **+ Add Query**.
2. Enter a **Query Name**.
3. Click **Submit**.
4. Select the **AWS Region**.
5. Select a **CloudWatch Log Group**. This field also accepts a Harness expression or runtime input.
6. Under **Define Query**, enter your [CloudWatch Logs Insights query](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). This query also accepts a runtime input or expression.
7. After entering your fixed input query, click **Run Query**.
8. Complete the field mapping for the **Timestamp Identifier**, **Service Instance Identifier**, and **Message Identifier**. To do so, click the **+** icon and select the relevant field from the log results.

   ![Field mapping panel showing the Timestamp Identifier, Service Instance Identifier, and Message Identifier selections](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-d07ec2466363f88ff134e5bd04f6869ba0022a65%2Ffield-mapping.png?alt=media)
9. Click **Submit**. The health source is displayed in the AI Verify (v1) step.
   {% endtab %}
   {% endtabs %}

You can add one or more health sources for each APM or logging provider.

***

## Next steps

After you add CloudWatch as a health source, you can run your deployment pipeline and review the verification results.

* [Configure CV](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/verify-deployments.md): Review the full CV configuration workflow and available options.
* [CloudWatch IAM permissions](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/health-sources/cloudwatch-aws.md): Review the IAM permissions and trust policy details required for each AWS connector credential type.
* [Health sources overview](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv.md): Explore other supported health source providers for Continuous Verification.

{% @harness-feedback/feedback %}
