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

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use airflow and step functions together to run data jobs and cloud tasks. Airflow schedules the main schedule while Step Functions runs serverless state machines. This pairing lets data teams trigger cloud tasks from one central place. Each tool handles the jobs it does best. Data engineers keep their Python workflows. Cloud teams keep their state machines in AWS. How airflow and step functions share permissions and data Airflow needs an AWS role to start a state machine run. A worker

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 use airflow and step functions together to run data jobs and cloud tasks. Airflow schedules the main schedule while Step Functions runs serverless state machines.

This pairing lets data teams trigger cloud tasks from one central place. Each tool handles the jobs it does best. Data engineers keep their Python workflows. Cloud teams keep their state machines in AWS.

How airflow and step functions share permissions and data

Airflow needs an AWS role to start a state machine run. A worker node takes on an IAM role with start permissions. Then it sends a JSON payload to the AWS API. Step Functions reads this input and starts the state machine.

Airflow can wait for the run to finish or move on. In sync mode, the worker polls AWS to check the status. In async mode, a sensor checks the state machine later. Async mode frees up worker slots during long cloud jobs.

Step Functions passes small JSON blocks between its own steps. It should not hold raw data or large files in the payload. Instead, pass bucket paths so both tools read from storage. When the state machine ends, it returns a small status output.

Common failure modes and how to scope roles

Many teams give Airflow one wide IAM role for all tasks. That single role can start any state machine in the account. If one workflow breaks or leaks, every state machine is at risk. Shared service roles also make audit logs hard to read.

Static keys stored in Airflow variables create another big risk. Keys do not rotate on their own and often leak in logs. You should assign short-lived roles to specific task groups instead. Map each Airflow task to one state machine ARN in IAM.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Payloads can also leak sensitive data into plain text logs. Engineers sometimes pass user emails or phone numbers in execution inputs. Both tools write those inputs into their run histories. If you must send sensitive fields, mask emails and card numbers first. Better yet, store the data in an encrypted bucket and pass a pointer.

Handling network paths and timeouts across both tools

Network drops between the scheduler and AWS can cause duplicate runs. If a worker times out, Airflow retries the task by default. Without a unique run name, the retry starts a second state machine. Always set a unique token for each run based on the schedule date.

Keep network paths between your cluster and AWS private. Route API calls through private endpoints instead of the public internet. Set strict timeout rules on both sides of the workflow. A hung state machine should fail fast so Airflow can alert the team.

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

Should Airflow wait for Step Functions to finish a run?

Use deferrable operators for any state machine that runs over one minute. This frees the worker slot while Airflow waits for the final status.

How do we stop duplicate state machine runs on task retries?

Pass a deterministic run name derived from the Airflow logical date. Step Functions will reject a second start request that uses the same active name.

Where should we store credentials for AWS API calls?

Never store raw AWS keys in workflow code or plain text fields. Attach an IAM role to the worker identity and scope it per task.

Teams that document these role rules and review logs each month catch config drift early. Clear ownership for each role keeps live systems simple to run and easy to audit across the whole team.

The query runs. The emails stay hidden.