The Simplest Way to Make Step Functions and Tcp Proxies Work Like They Should
Teams use step functions and tcp proxies to run cloud tasks across private networks. State machines trigger worker jobs that talk through network routers to reach internal systems. This setup lets cloud workflows reach databases and services that lack public web APIs. A state machine calls a compute task, and that task opens a raw socket. The router forwards packets to the right private host while keeping the target off the open web. How data and roles flow in step functions and tcp proxies
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 step functions and tcp proxies to run cloud tasks across private networks. State machines trigger worker jobs that talk through network routers to reach internal systems.
This setup lets cloud workflows reach databases and services that lack public web APIs. A state machine calls a compute task, and that task opens a raw socket. The router forwards packets to the right private host while keeping the target off the open web.
How data and roles flow in step functions and tcp proxies
State machines do not open raw network sockets on their own. Instead, a step triggers a serverless function or a container task inside a private network. That worker task then opens a socket to the network router endpoint.
First, the workflow engine checks its cloud role to see if it can run the worker. Next, the worker starts up and reads its own identity role. The worker uses this role or a stored secret to log in to the target system.
The network router sits between the worker subnet and the backend host subnet. It checks the source IP address and target port before it forwards any bytes. Once the socket opens, the worker sends its query or command and waits for a reply. When the reply arrives, the worker closes the socket and returns JSON to the state machine.
Common failure modes and how to scope network paths
Many teams share one broad service account across every step in a state machine. If one task leaks a key, an attacker can reach every backend database. You should assign a separate, narrow cloud role to each worker task in the workflow.
Connection storms are another common problem when state machines run many parallel branches. Serverless workers spin up fast and open hundreds of new sockets at the same time. The network router or the backend database can run out of open ports and drop work. Teams fix this by setting max concurrency limits on the state machine branches.
Cloud Functions IAM + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged traffic also creates blind spots during a security review. Raw network routers only see packet counts and IP addresses, not the queries inside the stream. If a workflow modifies records, the network log only shows that a worker IP connected. To fix this, place each worker in a dedicated subnet with strict security group rules. Give each workflow step its own database user so database logs show which step ran each query.
Handling timeouts and retries across network hops
Network sockets and state machines handle timeouts in very different ways. A network router will drop an idle socket if no bytes flow for a few minutes. Meanwhile, a long workflow step might still be waiting for a slow database job to finish.
When the router drops the idle socket, the worker task hangs until its own timer ends. The state machine then retries the step, which starts a duplicate job on the backend host. You can prevent this by turning on TCP keepalive packets in the worker code. You should also set the worker timeout lower than the state machine step timeout. Make sure every database write uses a unique task ID so retries do not create duplicate rows.
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
Can a state machine open a raw TCP socket directly?
No, state machines only call cloud APIs and supported service endpoints. You must trigger a compute worker like a function or container to open a raw socket.
How do I stop parallel workflow steps from exhausting ports?
Set a strict concurrency limit on the map or parallel state in your workflow. You can also reuse sockets inside warm worker instances instead of opening new ones each run.
How should we mask sensitive fields in workflow state payloads?
Data masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs in results. This keeps sensitive strings out of state machine execution history logs while the workflow runs.
Related guides
In this post