The Simplest Way to Make Cloud Functions and Step Functions Work Like They Should
Teams pair cloud functions and step functions to run multi-step workflows across cloud providers. Step Functions handles the workflow state while Cloud Functions runs the event code. This setup lets one state machine call code on another cloud. Your team can process data where it lives without moving large files first. You keep state rules in one place and run tasks on Google Cloud. How cloud functions and step functions share permissions and data Step Functions acts as the central state mac
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 cloud functions and step functions to run multi-step workflows across cloud providers. Step Functions handles the workflow state while Cloud Functions runs the event code.
This setup lets one state machine call code on another cloud. Your team can process data where it lives without moving large files first. You keep state rules in one place and run tasks on Google Cloud.
How cloud functions and step functions share permissions and data
Step Functions acts as the central state machine inside your AWS account. It tracks each step, manages retries, and passes JSON data between tasks. Cloud Functions runs as a lightweight HTTP endpoint on Google Cloud. When a state reaches a task, Step Functions sends an HTTPS request out.
Good identity rules keep this cross-cloud call safe from attackers. You should not use static keys or open public URLs for these calls. Instead, use workload identity federation between your AWS role and Google Cloud. Step Functions assumes an IAM role and requests a token for the call.
Google Cloud checks this token before it lets the function run. The function reads the JSON payload, runs its task, and sends data back. Step Functions reads the response and picks the next step in the flow. Both tools log their own part of the run in their native logs.
Common failure modes in cross-cloud workflows
Many teams start by sharing one broad service account across all functions. If an attacker steals that key, they gain wide rights in your project. Long-lived API keys stored in state input payloads also create huge risks. Those keys often show up in plain text inside execution history logs.
Timeouts and retry storms cause another major issue for production teams. Step Functions might retry a slow HTTP call while the function still runs. If the function is not idempotent, it will write duplicate data records. Unlogged database queries inside the function make this bug very hard to fix.
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 these issues with strict role scoping and network rules. Give each function its own service account with only the rights it needs. Pass an execution ID in every call so the function skips duplicate work. Strip sensitive fields like emails or card numbers before saving state logs.
Scoping network paths and audit logs for production
Public endpoints make cross-cloud calls easy to set up at first. Still, open URLs expose your functions to unwanted traffic and high bills. Teams should lock down ingress settings and require strict identity checks on every call. You can also route traffic through private network links between the two clouds.
Tracing a single request across two cloud logging systems takes a lot of time. When a workflow fails, engineers must check both consoles to find the root cause. Passing a shared trace ID in the request header solves this problem well. Your team can then match the state step to the exact function log.
Data privacy rules also matter when state machines pass user data around. State logs save the full input and output of every single step. If a function returns phone numbers or national IDs, the state log keeps them. Masking rewrites matched fields in results before they reach the state history.
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 Step Functions call a Google Cloud Function?
Step Functions uses an HTTP task state to call the Cloud Function URL. It sends a signed request or token that Google Cloud checks before running code.
How do we avoid storing static keys in state machines?
Use workload identity federation to exchange your AWS task role for a short token. This setup lets Step Functions call Google Cloud without storing static keys.
How do we prevent duplicate runs during task retries?
Send a unique step execution ID in the request payload to your function. Have the function check that ID in a table before it writes changes.
Related guides
In this post