Hourly Amazon SQS queue metrics logged to Google Sheets
Every hour, log queue backlog and dead-letter growth from Amazon SQS into a Google Sheet so your team can chart trends and spot regressions.
Every hour, pull queue depth metrics from Amazon SQS and append one row per queue to a Google Sheet so the team can chart backlog and dead-letter growth over time without setting up CloudWatch alarms.
Trigger: cron on an hourly schedule. Make the cron expression a workflow input so anyone can dial it up or down (every 15 minutes, every 6 hours) without editing code.
Inputs (all configurable): a Google Sheets spreadsheet ID, a sheet/tab name (default "sqs-metrics"), and how to select queues — either an explicit list of queue URLs, or a name prefix used to discover queues. Support both modes: if the queue-URL list is non-empty use it verbatim; otherwise call Amazon SQS ListQueues with the configured QueueNamePrefix to discover queues in the connected region. When neither is set, fall back to ListQueues with no prefix so every queue in the region is logged.
For each queue URL, call Amazon SQS GetQueueAttributes and request these four attribute names: ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, ApproximateNumberOfMessagesDelayed, and ApproximateAgeOfOldestMessage. Derive the queue name as the last path segment of the QueueUrl so the sheet stays human-readable.
Once all queues are collected, append rows to the Google Sheet in a single Google Sheets Append Values call (one row per queue, batched into the same request). Use valueInputOption USER_ENTERED and target the range <sheetName>!A:F. Columns, in order: timestamp (ISO 8601 UTC of when the run started, same value for every row in this run), queue name, visible (ApproximateNumberOfMessages as an integer), in flight (ApproximateNumberOfMessagesNotVisible as an integer), delayed (ApproximateNumberOfMessagesDelayed as an integer), oldest age seconds (ApproximateAgeOfOldestMessage as an integer).
Header row: on the first run against an empty sheet, prepend a header row with the six column names above so the resulting sheet is chart-ready. On subsequent runs, do not touch existing rows — Append Values naturally lands after the last populated row of the detected table.
Error handling: if GetQueueAttributes fails for a single queue (for example the queue was deleted between ListQueues and the read), log a warning and skip that queue rather than aborting the run; still append rows for the queues that succeeded. If Amazon SQS returns RequestThrottled, retry that single queue with exponential backoff (start around 1s, cap around 30s). If the Google Sheets append returns 429, retry the append with exponential backoff. Any other failure should end the run so it surfaces in the workflow history.
Output: a rolling time series in Google Sheets that the team can chart directly (line chart of visible vs in flight per queue, or a filter view for a single queue name) to spot backlog regressions and dead-letter growth by eye. No alerting is in scope — the goal is trend visibility.
Additional information
What does this prompt do?
- Every hour, reads the current queue depth for each of your Amazon SQS queues — visible messages, in-flight messages, delayed messages, and how old the oldest message is.
- Appends one row per queue to a Google Sheet you already own, with a shared timestamp so every hour lines up as a single data point.
- Discovers queues automatically by name prefix, or reads a fixed list you provide, so new queues start being tracked without code changes.
- Gives your team a chartable time series they can use to eyeball backlog trends and dead-letter growth without setting up dashboards or alarms.
What do I need to use this?
- An AWS account with Amazon SQS queues you want to track, and read access to those queues.
- A Google account and a Google Sheet where the metrics should land — you'll paste the spreadsheet link into the workflow.
- A rough idea of which queues to include (an explicit list, a shared name prefix, or all queues in the region).
How can I customize it?
- Change the schedule from hourly to every 15 minutes, every 6 hours, or once a day.
- Point at a specific set of queues by pasting queue URLs, or use a name prefix (like "prod-") to auto-discover them.
- Rename the sheet tab, or split production and staging into separate tabs by cloning the workflow with different inputs.
Frequently asked questions
Do I need CloudWatch or a paid monitoring tool for this?
What if I add a new queue later?
Will this slow down my queues or cost extra?
Can I chart the data automatically?
Does this work with FIFO queues?
Related templates
Watch your queue backlogs without touching CloudWatch.
Get an hourly, chartable record of every Amazon SQS queue directly in Google Sheets and catch backlog regressions before they page you.