Aws/metrics
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)
2026.07.30.1
Added: Optional profile global argument for multi-account credential resolution.
When set, credentials resolve via fromIni (supports SSO token cache and shared-config
profiles). When omitted, the default credential chain applies as before. Fully backward
compatible — no changes required for existing instances.
| Argument | Type | Description |
|---|---|---|
| namespace | string | AWS namespace (e.g., AWS/EC2) |
| metricName | string | Metric name (e.g., CPUUtilization) |
| name | string | |
| value | string |
| Argument | Type | Description |
|---|---|---|
| namespace | string | AWS namespace (e.g., AWS/EC2) |
| metricName | string | Metric name (e.g., CPUUtilization) |
| name | string | |
| value | string |
| Argument | Type | Description |
|---|---|---|
| instanceId | string | EC2 instance ID |
| Argument | Type | Description |
|---|---|---|
| functionName | string | Lambda function name |
Resources
2026.07.29.1
Fixed: Terminate upgrade chain at current version (extension was uninstallable due to broken upgrade chain).
2026.07.27.1
Changed: Bump @aws-sdk/client-cloudwatch 3.1094.0 → 3.1096.0
2026.07.24.1
Changed: Bump AWS SDK from 3.1091.0 to 3.1094.0 (patch-level update).
2026.07.24.1
Changed: Bump AWS SDK from 3.1091.0 to 3.1094.0 (patch-level update).
2026.07.21.1
Changed: Bumped AWS SDK dependencies to 3.1091.0 (from 3.1090.0).
Upgrade note: No behavioral changes. Routine dependency maintenance.
2026.07.18.2
Added: An upgrades array entry (no-op) to metrics.ts for proper typeVersion tracking on existing instances. No schema or behavior changes.
2026.07.18.1
Changed: Bumped @aws-sdk/client-cloudwatch from 3.1069.0 to
3.1090.0 for dependency freshness. No behavior change.
2026.07.18.1
Changed: Bumped @aws-sdk/client-cloudwatch from 3.1069.0 to
3.1090.0 for dependency freshness. No behavior change.
updated platforms
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned