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

Published
Length
3 min read

Luis Felipe Dias

All posts

Using step functions and teamcity together lets build servers trigger cloud state machines. TeamCity builds your code and starts an AWS workflow to run tests or deploy apps. This setup keeps build logic in TeamCity and cloud tasks in AWS. Teams get clear logs for both code builds and cloud state changes. Each tool does what it is best at doing. How step functions and teamcity share identity and data TeamCity needs a safe way to log in to your AWS account. The best approach uses OpenID Connec

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.

Using step functions and teamcity together lets build servers trigger cloud state machines. TeamCity builds your code and starts an AWS workflow to run tests or deploy apps.

This setup keeps build logic in TeamCity and cloud tasks in AWS. Teams get clear logs for both code builds and cloud state changes. Each tool does what it is best at doing.

How step functions and teamcity share identity and data

TeamCity needs a safe way to log in to your AWS account. The best approach uses OpenID Connect to trade a build token for an AWS role. This setup avoids saving static cloud keys inside your TeamCity project settings.

When a build finishes, the build agent assumes an IAM role with narrow rights. The agent sends a start call to the state machine with a small JSON payload. This payload holds the build number, git commit hash, and artifact path.

The workflow can also call back to the TeamCity server. A state machine task can Wait for a Task Token during a long build job. TeamCity runs the job and sends the token back to AWS when done. The state machine then moves to the next step based on that result.

Common failure modes and how to scope roles

Many teams make the mistake of using one shared IAM user for all builds. If a bad actor steals that static key, they can reach every state machine. Shared accounts also make it hard to see which project started a cloud run.

Broad tokens in TeamCity create the same risk on the build server side. If an AWS task uses an admin token, a flaw can expose all build plans. Unlogged API calls between the two tools leave blind spots during a security review.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Fix this by scoping each TeamCity project to its own AWS IAM role. Write the role policy so it can only start one specific state machine. Use trust rules that check the exact project ID from the build token.

On the network side, keep traffic off the public internet when you can. Run self-hosted build agents inside your private cloud network. Let those agents reach the state machine API through a private VPC endpoint. This path keeps your build payloads and cloud calls inside your own network boundary.

Managing build state and error recovery

Network drops between the build agent and the cloud API will happen over time. If a build script fires a workflow and exits, it might miss a failure. Your pipeline then marks the build green while the cloud deploy breaks.

Build agents should poll the state machine status or wait for a callback event. Set clear timeout limits on both the TeamCity build step and the state machine. If a step hangs, the state machine should catch the error and stop the run.

Pass a unique run name from the build server to the state machine every time. Use the project name and build number to create this run ID. This simple rule stops duplicate runs if a build agent retries a failed network call.

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 TeamCity wait for the state machine to finish?

Yes, if the workflow deploys code or runs tests that gate the release. For long tasks, use the callback pattern so the build agent does not sit idle.

How do we stop one project from starting another team's workflow?

Map each TeamCity project to a unique IAM role using OpenID Connect claims. Scope each role policy to allow start calls on one state machine ARN only.

What data should we pass from the build to the workflow?

Send only metadata like the commit SHA, build ID, and storage URI. Never put secret keys, passwords, or raw customer data like emails into the state payload.

The query runs. The emails stay hidden.