For the complete documentation index, see llms.txt. This page is also available as Markdown.
BETAContinuous DeliveryContinuous VerificationCloudwatch

CloudWatch Logs

Configure CloudWatch Logs as a Continuous Verification health source, including IAM permissions for Access Keys, Assume Role, IRSA, dynamic Role ARN, and OIDC

This feature is in Beta and requires enablement. View all early access features.

Use Amazon CloudWatch Logs as a health source for Continuous Verification. This topic covers prerequisites, configuration notes, and the IAM permissions required for Access Keys, cross-account Assume Role, IRSA, dynamic Role ARN, and OIDC.

Feature availability and delegate version

CloudWatch Logs health source support requires the feature flag CDS_CV_CLOUDWATCH_LOGS_ENABLED. The oldest supported delegate version is 858xx.


What you will learn from this topic


Before you begin

  • Continuous Verification setup: Configure an AI Verify (v1) step and health sources in your Deploy stage. Go to Configure Continuous Verification to set up verification.

  • AWS connector: Create or select an AWS connector that can reach CloudWatch Logs. Go to AWS connector settings reference to configure credentials, Assume Role, IRSA, or OIDC.

  • Delegate version: Use delegate version 858xx or later for CloudWatch Logs, 859xx or later for dynamic Role ARN, and 89800 or later for OIDC.


General instructions

Use the following rules for each CloudWatch Logs Continuous Verification configuration:

  • Select only one AWS region.

  • Select multiple log groups when needed. If you enter a log group name manually, press Enter to register the value in the form.

  • Start from a sample query such as: fields @log, @logStream, @message, @timestamp


IAM permissions

Describe Regions

By default, the AWS connector requires the ec2:DescribeRegions permission for validation. You can add it with the following policy. You can remove this requirement with the feature flag CDS_AWS_DESCRIBE_REGIONS_OPTIONAL. Go to DescribeRegions - Optional for details.

Logs

Harness uses these CloudWatch Logs APIs:

  • Describe Log Groups

  • Start Query

  • Get Query Results

The credentials in the AWS connector must allow those operations. The following sample policies show the required shape.

Restrict DescribeLogGroups by region

Replace the first * with an AWS region to list log groups from that region only.

Restrict query APIs by region

Replace the first * with an AWS region if you want to restrict Start Query and Get Query Results to that region only.

These permissions are enough when you configure the connector with AWS Access Keys credentials only.


Advanced permissions for Assume IAM role and IRSA

If you configure the AWS connector with either of the following options, add the permissions in this section in addition to the Logs and DescribeRegions permissions above:

  • Assume IAM role on delegate

  • IRSA (IAM Role on Service Account)

Assume IAM Role on Delegate with STS enabled

When you also enable cross-account access (STS Role), the IAM Role ARN must allow the delegate to assume it, and the delegate role must allow that AssumeRole call. The setup needs a two-way handshake with permission policies and trust policies.

Suppose IAM_Role_ARN_LOGS in Account A (where CloudWatch Logs live) must be assumed by a delegate in Account B that uses IAM_Role_ARN_DELEGATE. Confirm that IAM_Role_ARN_LOGS also has the CloudWatch Logs and DescribeRegions permissions from the earlier section.

Use a trust policy on IAM_Role_ARN_LOGS similar to the following:

Also grant IAM_Role_ARN_DELEGATE permission to assume roles. For example:

IRSA

For IRSA, annotate the correct service account. If the service account role ARN is IAM_Role_ARN_SERVICE_ACCOUNT, use a trust policy on IAM_Role_ARN_LOGS similar to the following:

Also grant IAM_Role_ARN_SERVICE_ACCOUNT permission to assume IAM_Role_ARN_LOGS. For example:


Dynamic Role ARN

Prerequisites

  • Feature flag CDS_CV_CLOUDWATCH_DYNAMIC_ROLE_ARN_ENABLED must be enabled.

  • Oldest supported delegate version is 859xx.

IAM permissions

Permissions match Assume IAM Role with STS for the new dynamic role ARN (for example, Dynamic_Role_ARN_1). The dynamic role ARN must allow the delegate to assume it, and the delegate must be able to assume the dynamic role.

Permission policies

Grant the same CloudWatch Logs and DescribeRegions permissions described earlier.

Trust policies

Use a trust policy similar to Assume IAM role:

Setup

Enable the Dynamic ARN toggle, enter the dynamic role ARN in the text box that appears, then select the region and log group.

CloudWatch Logs health source with Dynamic ARN enabled, role ARN field, region, and log group

OIDC authentication

Harness supports OIDC-based AWS connectors for both CloudWatch Logs and CloudWatch Metrics health sources. With OIDC, Harness exchanges a short-lived identity token for temporary AWS credentials, so you do not need to store long-lived access keys or run a delegate with inherited IAM permissions.

Delegate version for OIDC

This feature requires a minimum delegate version of 89800.

Trust policy

The IAM role that the connector assumes must trust the Harness OIDC identity provider. Replace <AWS_ACCOUNT_ID> and <HARNESS_ACCOUNT_ID> with your values.

IAM permissions for OIDC

Attach the same CloudWatch permissions to the OIDC role that you use for other credential types. The following policy covers both CloudWatch Logs and CloudWatch Metrics health sources.

If you only use CloudWatch Logs, you can omit the cloudwatch:GetMetricData and cloudwatch:ListMetrics actions. If you only use CloudWatch Metrics, you can omit the logs:* actions.

Cross-account access with OIDC

To access CloudWatch data in a different AWS account, add sts:AssumeRole to the OIDC role permission policy and configure the target account role trust policy to allow the OIDC role to assume it. This pattern matches Assume IAM Role on Delegate with STS enabled, except the source role is the OIDC role rather than a delegate-bound role.

If you use a per-query role ARN override (CloudWatch Logs only), the override chains from the OIDC session credentials rather than from the delegate ambient identity. Go to Dynamic Role ARN for setup details.


Next steps

Last updated

Was this helpful?