CloudWatch Block
Query logs, metrics, and alarms in AWS CloudWatch
The CloudWatch block integrates AWS CloudWatch into your workflows, letting you query log groups, retrieve metric statistics, publish custom metrics, and inspect alarms. Reach for it when a workflow needs to observe or react to the state of your AWS infrastructure.
Overview
| Property | Value |
|---|---|
| Type | cloudwatch |
| Category | tools |
| Color | #B0084D |
When to Use
- Run a CloudWatch Logs Insights query to pull recent log lines from a Lambda or service log group.
- Fetch raw log events from a specific log stream for inspection or downstream processing.
- Discover available log groups or metrics before drilling into a particular one.
- Get metric statistics (e.g. CPUUtilization) to drive conditional logic or alerting.
- Publish custom metric data points back into CloudWatch from your workflow.
- Describe alarms to check whether any monitored resource is in an alarm state.
Configuration
Operation
Required dropdown that selects which CloudWatch action to run. The available options are:
| Label | id |
|---|---|
| Query Logs | cloudwatch_query_logs |
| Describe Log Groups | cloudwatch_describe_log_groups |
| Get Log Events | cloudwatch_get_log_events |
| List Metrics | cloudwatch_list_metrics |
| Get Metric Statistics | cloudwatch_get_metric_statistics |
| Put Metric Data | cloudwatch_put_metric_data |
| Describe Alarms | cloudwatch_describe_alarms |
AWS Region
The AWS region to target (e.g. us-east-1). Required for every operation.
Access Key ID / Secret Access Key
AWS credentials used to authenticate the request. Both are required for every operation and stored as secrets — use {{AWS_ACCESS_KEY_ID}} and {{AWS_SECRET_ACCESS_KEY}} to inject them from environment variables.
Log Group Names (logGroupNames)
The log group(s) to operate on, comma-separated or as a single name. Visible for Query Logs (cloudwatch_query_logs) and Get Log Events (cloudwatch_get_log_events).
Insights Query (queryString)
A CloudWatch Logs Insights query string (e.g. fields @timestamp, @message | sort @timestamp desc | limit 20). Visible for Query Logs (cloudwatch_query_logs) only.
Metric Name (metricName)
The name of the metric (e.g. CPUUtilization). Visible for Get Metric Statistics (cloudwatch_get_metric_statistics) and Put Metric Data (cloudwatch_put_metric_data).
Namespace (namespace)
The metric namespace (e.g. AWS/EC2, AWS/Lambda, Custom/MyApp). Visible for Get Metric Statistics (cloudwatch_get_metric_statistics) and Put Metric Data (cloudwatch_put_metric_data).
Inputs & Outputs
-
Inputs:
operation(string) — Operation to performawsRegion(string) — AWS regionawsAccessKeyId(string) — AWS access key IDawsSecretAccessKey(string) — AWS secret access keylogGroupNames(string) — Log group names (used by Query Logs and Get Log Events)queryString(string) — CloudWatch Insights query (used by Query Logs)metricName(string) — Metric name (used by Get Metric Statistics and Put Metric Data)namespace(string) — Metric namespace (used by Get Metric Statistics and Put Metric Data)
-
Outputs:
logEvents(json) — Log eventsmetrics(json) — Metrics dataqueryId(string) — Query ID
Tools
Each operation maps to a dedicated tool. The block selects the tool at runtime based on the value of the operation input.
-
CloudWatch Query Logs (
cloudwatch_query_logs) — Runs a CloudWatch Log Insights query against one or more log groups. Key params:logGroupNames,queryString,startTime,endTime, optionallimit. Returnsresults(array) andstatus(string). -
CloudWatch Describe Log Groups (
cloudwatch_describe_log_groups) — Lists available CloudWatch log groups. Optional params:prefix(name filter),limit. ReturnslogGroups(array). -
CloudWatch Get Log Events (
cloudwatch_get_log_events) — Retrieves log events from a specific CloudWatch log stream. Key params:logGroupName,logStreamName, optionalstartTime,endTime,limit. Returnsevents(array). -
CloudWatch List Metrics (
cloudwatch_list_metrics) — Lists available CloudWatch metrics. Optional params:namespace,metricName,recentlyActive(only metrics active in the last 3 hours),limit. Returnsmetrics(array). -
CloudWatch Get Metric Statistics (
cloudwatch_get_metric_statistics) — Gets statistics for a CloudWatch metric over a time range. Key params:namespace,metricName,startTime,endTime,period(granularity in seconds),statistics(array of Average/Sum/Minimum/Maximum/SampleCount), optionaldimensions(JSON string). Returnslabel(string) anddatapoints(array). -
CloudWatch Publish Metric (
cloudwatch_put_metric_data) — Publishes a custom metric data point to CloudWatch. Key params:namespace,metricName,value, optionalunit(e.g. Count, Seconds, Bytes),dimensions(JSON string). Returnssuccess(boolean). -
CloudWatch Describe Alarms (
cloudwatch_describe_alarms) — Lists and filters CloudWatch alarms. Optional params:alarmNamePrefix,stateValue(OK, ALARM, INSUFFICIENT_DATA),alarmType(MetricAlarm, CompositeAlarm),limit. Returnsalarms(array).
YAML Example
cloudwatch_1:
type: cloudwatch
name: "CloudWatch"
inputs:
operation: "cloudwatch_query_logs"
awsRegion: "us-east-1"
awsAccessKeyId: "{{AWS_ACCESS_KEY_ID}}"
awsSecretAccessKey: "{{AWS_SECRET_ACCESS_KEY}}"
logGroupNames: "/aws/lambda/my-function"
queryString: "fields @timestamp, @message | sort @timestamp desc | limit 20"
connections:
outgoing:
- target: next-block-id