The Simplest Way to Make Pagerduty and Step Functions Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair pagerduty and step functions to trigger automated fixes during live incidents. When a cloud state machine fails, it sends an alert to the on-call engineer. That alert can also trigger a recovery workflow to check logs and restart tasks. This guide explains how both tools share keys, run tasks, and stay safe. How pagerduty and step functions pass alerts and jobs Data flows in two ways between your alert tool and your cloud workflows. First, a state machine hits an error and sends an

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair pagerduty and step functions to trigger automated fixes during live incidents. When a cloud state machine fails, it sends an alert to the on-call engineer. That alert can also trigger a recovery workflow to check logs and restart tasks. This guide explains how both tools share keys, run tasks, and stay safe.

How pagerduty and step functions pass alerts and jobs

Data flows in two ways between your alert tool and your cloud workflows. First, a state machine hits an error and sends an event out. Your cloud account routes this event to the alert service using an event bus. The alert tool reads the payload and pages the right team member right away.

Second, an alert can trigger a state machine to fix a known problem. When an incident starts, the alert tool sends a webhook to your cloud endpoint. That webhook starts a state machine run with the incident details as input. The workflow checks system health, collects debug info, and posts notes back to the incident.

Each direction needs its own keys and cloud roles to work well. For outbound alerts, the cloud event bus holds an integration key for the alert service. For inbound webhooks, the cloud endpoint checks a secret token before starting any workflow. The state machine then uses an execution role to read logs or restart apps.

Common security gaps and how to scope roles

Many teams rush this setup and use one broad key for all alerts. If that shared key leaks, anyone can flood your on-call team with fake pages. Even worse, teams often give the state machine a huge admin role. One bad webhook could then delete data or change production settings by mistake.

Unlogged actions create another big problem during a busy outage. When a workflow runs a database query, teams need to know what ran. If five state machines share one database user, the audit logs look the same. You cannot tell which incident triggered a specific write or table change.

Cloud Functions IAM + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix this by giving each workflow its own small cloud role. Scope each role so it only runs the exact tasks for that one incident type. Store your integration keys in a cloud secrets manager instead of plain text variables. Rotate those keys every few months so old tokens cannot cause harm.

Keeping sensitive data out of incident payloads

State machines often process user records, billing details, and internal system states. When a step fails, the error output might hold raw customer information. If the workflow dumps that whole state into an alert, private data leaks out. On-call engineers will see raw emails, phone numbers, or card numbers in their alerts.

Always filter the state payload before sending it to your alert tool. Send only the error code, the step name, and a safe run identifier. Keep the full input and output payloads inside your secure cloud logs. When workflows query databases to check an outage, use data masking on the results. Masking rewrites matched fields like emails and card numbers in query results right away. This keeps your incident timelines clean and protects customer privacy during every outage.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How do I stop duplicate pages when a state machine retries?

Send the unique execution name as the deduplication key in your alert payload. The alert tool will group all retries from that run into one single incident. Specify that alert only on the final failure state after all step retries finish.

Should PagerDuty call Step Functions directly or use an event bus?

Route webhooks through an API endpoint or an event bus before starting workflows. This setup lets you check headers, block bad payloads, and rate limit incoming calls. It also lets one incident webhook trigger multiple small workflows at the same time.

How should we manage secrets used by automated remediation steps?

Never hardcode API keys or database passwords inside your state machine definitions. Keep all secrets in a dedicated secret store and fetch them during the run. Grant the state machine role read rights only to the one secret it needs.

The query runs. The emails stay hidden.