SQS Exporter is a small Node.js service that exposes Prometheus metrics for one or more AWS SQS queues.
It polls queue attributes from AWS SQS and publishes these metrics:
sqs_approximate_number_of_messagessqs_approximate_number_of_messages_not_visiblesqs_approximate_number_of_messages_delayed
- Node.js 18+
- Access to AWS SQS with permission to call:
sqs:GetQueueUrlsqs:GetQueueAttributes
npm installSet these environment variables before starting the service:
SQS_QUEUES(required): comma-separated queue names, for exampleorders,notificationsAWS_REGION(optional): AWS region, defaults tous-west-2AWS_PROFILE(optional): local AWS profile name from~/.aws/credentialsPORT(optional): HTTP port, defaults to3001METRICS_REFRESH_INTERVAL_MS(optional): background refresh interval in milliseconds, defaults to15000
If AWS_PROFILE is set, the exporter uses that profile via shared credentials.
If AWS_PROFILE is not set, AWS SDK default credential resolution is used (for example environment variables, IAM role, ECS task role).
npm startServer startup will fail fast with a clear error when:
SQS_QUEUESis missing or emptyAWS_REGIONis invalidPORTis not a positive integerMETRICS_REFRESH_INTERVAL_MSis not a positive integerAWS_PROFILEis set but cannot be loaded
docker build -t sqs-exporter .
docker run -e SQS_QUEUES=my-queue -e AWS_REGION=us-east-1 -p 3001:3001 sqs-exporterThe container runs as a non-root user. A healthcheck against /ping is configured by default.
GET /ping: basic health check, returnspongGET /ready: readiness check, returns200after first successful metric refresh,503beforeGET /metrics: Prometheus metrics output (served from cache, no on-demand AWS calls)
| Resource | Recommended Limit | Notes |
|---|---|---|
| CPU | 100m | Sufficient for up to ~100 queues |
| Memory | 128Mi | Includes Node.js runtime overhead |
| CPU (high queue count) | 250m | 100+ queues with short refresh intervals |
| Memory (high queue count) | 256Mi | 100+ queues with short refresh intervals |
Each monitored queue contributes approximately 4 time series (3 SQS gauges + default Node.js metrics). Plan Prometheus capacity accordingly:
| Queues | Approximate Time Series |
|---|---|
| 10 | ~40 |
| 50 | ~200 |
| 100 | ~400 |
| 500 | ~2000 |
npm test