The Simplest Way to Make Redash and Step Functions Work Like They Should
You link redash and step functions by triggering query runs from your state machines. This setup lets your team automate data reports and act on fresh database rows. Data teams use Redash to query databases and build visual dashboards. AWS Step Functions coordinates cloud tasks into clear, step-by-step workflows. When you pair them, your workflows can run saved queries on a schedule. The state machine waits for the query to finish and reads the output. Then it can send alerts or start another j
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.
You link redash and step functions by triggering query runs from your state machines. This setup lets your team automate data reports and act on fresh database rows.
Data teams use Redash to query databases and build visual dashboards. AWS Step Functions coordinates cloud tasks into clear, step-by-step workflows. When you pair them, your workflows can run saved queries on a schedule. The state machine waits for the query to finish and reads the output. Then it can send alerts or start another job based on the data.
How redash and step functions pass keys and data
The workflow starts when a state machine step calls the Redash web API. It sends an HTTP request to start a specific query run. To do this, the state machine needs a valid API key. Redash checks this key before it runs any SQL against your data source.
Redash offers two main key types for API calls. A user API key carries the same rights as the person who owns it. A query API key only works for one specific query and its results. Your state machine should store this key inside a secret store.
Database queries take time to run and do not return data right away. When the state machine triggers a query, Redash returns a job ID. The state machine must wait and poll Redash until the job status shows complete. Once the job finishes, the workflow fetches the final result ID. If the data is small, the state machine reads the rows directly. If the result set is large, it should save the file to cloud storage.
Common failure modes and how to scope roles
Many teams make the mistake of using one personal admin key for every workflow. If that person leaves the company, all automated data pipelines break at once. A shared admin key also gives every state machine access to every data source. If one workflow gets compromised, an attacker can read all your tables.
Another big risk comes from how Redash connects to your databases. Teams often plug a single database user with write rights into Redash. Any query triggered by a state machine then runs with those broad rights. Database logs will only show the shared Redash account, not the workflow that ran it. You lose track of which state machine ran which query.
Cloud Functions IAM + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Query timeouts also cause trouble in automated runs. If a heavy query runs too long, the state machine might keep polling and waste money. You must set clear timeout rules on every wait loop in your workflow.
You can fix these issues with a few strict rules. First, use query API keys instead of user keys whenever your workflow allows it. Second, create a read-only database user just for your reporting queries in Redash. Third, keep your Redash server inside a private network. Use private cloud endpoints so state machine traffic never crosses the public internet.
Keeping sensitive data safe during automated runs
Automated workflows often pull customer tables to check business metrics or send alerts. If a query returns raw emails, phone numbers, or card numbers, that data lands in your state machine logs. Anyone who can read the workflow execution history will see those fields in plain text.
To prevent leaks, your SQL queries should only select the exact columns needed for the next step. Ask your data team to aggregate counts and totals inside the database first. You can also use data masking to rewrite matched fields like national IDs in the results before they reach the workflow logs.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How does a state machine wait for a slow Redash query?
Build a polling loop inside your state machine using a wait state and a choice state. The workflow starts the query, waits ten seconds, and checks the job status until it finishes.
Should we use a user key or a query key for automation?
Use a query key whenever you can because it only grants rights to one single query. If you must pass dynamic values or run many queries, create a dedicated bot user with read-only rights.
How do we handle large query results in Step Functions?
Step Functions has a strict size limit on state payloads passed between steps. Have a helper function grab the large Redash result and write it to an object storage bucket instead.
Related guides
In this post