01README
Query and analyze CloudWatch Metrics for operational visibility and performance monitoring.
Authentication
Uses the default AWS credential chain. Requires CloudWatch permissions.
Required IAM Permissions
cloudwatch:ListMetricscloudwatch:GetMetricStatisticscloudwatch:GetMetricData
Usage
# Create metrics model
swamp model create @webframp/aws/metrics aws-metrics --global-arg region=us-east-1
# List available metrics
swamp model method run aws-metrics list_metrics --input namespace=AWS/EC2
# Get metric data
swamp model method run aws-metrics get_data \
--input namespace=AWS/EC2 \
--input metricName=CPUUtilization \
--input 'dimensions=[{"name":"InstanceId","value":"i-1234567890abcdef0"}]' \
--input startTime=1h
# Analyze a metric for trends and anomalies
swamp model method run aws-metrics analyze \
--input namespace=AWS/Lambda \
--input metricName=Errors \
--input 'dimensions=[{"name":"FunctionName","value":"my-function"}]' \
--input startTime=6h
# Get EC2 CPU utilization (convenience method)
swamp model method run aws-metrics get_ec2_cpu --input instanceId=i-1234567890abcdef0
# Get Lambda function metrics
swamp model method run aws-metrics get_lambda_metrics --input functionName=my-functionTime Formats
The startTime and endTime parameters accept:
- Relative times:
30m,1h,2d(minutes, hours, days ago) - ISO 8601 dates:
2026-03-30T12:00:00Z
Methods
- list_metrics - Discover available CloudWatch metrics by namespace
- get_data - Retrieve metric data points with configurable statistics
- analyze - Analyze metrics for trends, anomalies, and summary statistics
- get_ec2_cpu - Convenience method for EC2 CPU utilization
- get_lambda_metrics - Get key Lambda function metrics (invocations, errors, duration, throttles)
02Models
@webframp/aws/metricsv2026.03.30.1aws/metrics.ts
fn list_metrics()
List available CloudWatch metrics by namespace
fn get_data(namespace: string, metricName: string, name: string, value: string)
Get metric data points for a specific metric
| Argument | Type | Description |
|---|---|---|
| namespace | string | AWS namespace (e.g., AWS/EC2) |
| metricName | string | Metric name (e.g., CPUUtilization) |
| name | string | |
| value | string |
fn analyze(namespace: string, metricName: string, name: string, value: string)
Analyze a metric for trends, anomalies, and summary statistics
| Argument | Type | Description |
|---|---|---|
| namespace | string | AWS namespace (e.g., AWS/EC2) |
| metricName | string | Metric name (e.g., CPUUtilization) |
| name | string | |
| value | string |
fn get_ec2_cpu(instanceId: string)
Convenience method to get EC2 CPU utilization
| Argument | Type | Description |
|---|---|---|
| instanceId | string | EC2 instance ID |
fn get_lambda_metrics(functionName: string)
Get key Lambda function metrics (invocations, errors, duration)
| Argument | Type | Description |
|---|---|---|
| functionName | string | Lambda function name |
Resources
metric_list(1h)— List of CloudWatch metrics
metric_data(1h)— CloudWatch metric data points
metric_analysis(1h)— Metric analysis with trend and anomalies
03Previous Versions
2026.04.13.1Apr 13, 2026
2026.03.31.1Mar 31, 2026
2026.03.30.1Mar 30, 2026
04Stats
A
100 / 100
Downloads
17
Archive size
222.4 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types1/1earned
- Has description1/1earned
- At least one platform tag (or universal)1/1earned
- Two or more platform tags (or universal)1/1earned
- License declared1/1earned
- Verified public repository2/2earned
05Platforms
06Labels