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

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing cloud run and step functions lets teams run cross-cloud workflows with ease. Step Functions manages the workflow state while Cloud Run hosts the stateless compute containers. This setup helps teams trigger Google Cloud containers from AWS state machines. You can process data, run batch jobs, or call internal APIs across both clouds. Each platform handles what it does best without adding heavy server management. How cloud run and step functions share identity and data Moving data betwe

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.

Pairing cloud run and step functions lets teams run cross-cloud workflows with ease. Step Functions manages the workflow state while Cloud Run hosts the stateless compute containers. This setup helps teams trigger Google Cloud containers from AWS state machines. You can process data, run batch jobs, or call internal APIs across both clouds. Each platform handles what it does best without adding heavy server management.

How cloud run and step functions share identity and data

Moving data between AWS and Google Cloud requires a strong trust model. Step Functions runs inside AWS and uses an IAM role for its identity. Cloud Run sits inside Google Cloud and checks IAM roles before allowing requests. To link them, you should set up workload identity federation in Google Cloud. This feature lets your AWS state machine trade its AWS token for a Google token.

Once the state machine has a valid token, it sends an HTTPS request. The Step Functions workflow calls the Cloud Run service URL and passes JSON data. Cloud Run checks the token, runs the container, and sends back a JSON response. Step Functions reads this response and decides which workflow step to run next. No static keys ever need to live inside your workflow code or state data.

Common failure modes and how to scope roles

Many teams make the mistake of using long-lived service account keys for cross-cloud calls. Engineers paste these static JSON keys into state machine settings or secret stores. If a key leaks, an attacker gets permanent entry to your Google Cloud project. Shared service accounts also cause huge blind spots during security audits. When five workflows share one account, you cannot tell which workflow triggered a specific container.

Overly broad permissions create another major risk for engineering teams. A workflow might hold a role that allows calling every service in a project. Instead, you must give each state machine its own dedicated IAM role. Map that single AWS role to one specific Cloud Run service invoker role. Keep the permissions tight so a broken workflow cannot touch other services.

Unlogged calls and timeouts also break cross-cloud workflows in production. Step Functions waits for an HTTP response, so slow containers can cause timeouts. You should set clear timeout limits on both the state machine and the container. For long tasks, have Cloud Run accept the job and send an async callback token. Turn on request logs in both clouds so you can trace every single run.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Securing network paths and sensitive payload data

Public endpoints make cross-cloud calls simple, but they expose your services to internet traffic. Always require IAM checks on your Cloud Run URLs to block random public requests. If your security rules ban public traffic, set up a private network tunnel between clouds. You can route traffic through a site-to-site VPN or a dedicated interconnect link.

Pay close attention to the JSON payloads moving between your workflow steps. State machines record input and output data in their execution history logs. If a container returns emails, phone numbers, or card numbers, those details stay in logs. Data masking rewrites matched fields in results before they reach your state history. This keeps sensitive user details out of plain sight while your workflows run.

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 does Step Functions log in to a private Cloud Run service?

Step Functions uses an AWS role to get a token from Google workload identity federation. It then passes that short-lived token in the HTTP header to run the container.

How do we handle long jobs that pass the request timeout limit?

Use the task token pattern in Step Functions to pause the workflow execution. Cloud Run processes the work in the background and calls back when the job finishes.

Should we pass large data payloads directly between these two tools?

No, Step Functions has strict size limits for state payloads passed between steps. Store large files in cloud storage buckets and pass only the file path in JSON.

The query runs. The emails stay hidden.