The Simplest Way to Make AWS Secrets Manager and Teamcity Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using aws secrets manager and teamcity together lets build jobs fetch keys at run time. This workflow stops teams from storing plain text passwords inside build settings or code repos. Build servers need database logins, API tokens, and cloud keys to test and ship code. Hardcoding those values inside project settings creates a big risk for your team. Linking your build server to a cloud secret store fixes that problem right away. How aws secrets manager and teamcity share data The two tools

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 aws secrets manager and teamcity together lets build jobs fetch keys at run time. This workflow stops teams from storing plain text passwords inside build settings or code repos.

Build servers need database logins, API tokens, and cloud keys to test and ship code. Hardcoding those values inside project settings creates a big risk for your team. Linking your build server to a cloud secret store fixes that problem right away.

How aws secrets manager and teamcity share data

The two tools talk through cloud roles and temporary tokens during a build run. First, the build server or build agent takes on an AWS identity role. Instead of saving long-term cloud keys, admins use role assumption or web identity federation. The build server asks AWS for a short-term session token before the job starts.

Next, AWS checks the role policy tied to that specific build agent or project. The policy lists which secret names the build job is allowed to read. If the rule matches, the cloud store sends the encrypted value over a secure link. The build agent then loads that value into memory for the active build step.

TeamCity can also scrub known secret values from the build log text. If a script prints a variable by mistake, the log shows stars instead. Once the build finishes, the agent wipes the temporary variables from its local memory.

Common failure modes and how to scope roles

Many teams set up this link with one giant shared role for all agents. When every build agent shares one broad role, any project can read production keys. A test job on a feature branch could fetch the main database password. Static cloud keys pasted into root project settings create the exact same danger.

Unlogged secret reads also cause problems during security audits. If ten projects use the same IAM user, cloud logs cannot show which build ran. You only see the shared user name in the audit trail. You cannot tell which developer or commit triggered the secret read.

AWS Secrets Manager + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, split your build agents into separate pools by trust level. Put production deploy agents in one pool and test agents in another pool. Give each pool its own cloud role with strict read rules. Path tags on secrets help you lock down read rules to one project.

Lock down network paths between your build agents and the cloud endpoints too. Use private network endpoints so secret traffic stays inside your cloud network. Turn on cloud audit logs for every secret read event in your account. Match those read timestamps against your build history to spot odd jobs fast.

Keeping build scripts safe after secret delivery

Fetching a key safely is only half the battle for a build pipeline. Once a build script has a database password, it runs raw commands directly. Standard secret tools do not see what queries the script runs after login. Teams should limit what the target database user can do during a deploy.

Create separate database logins for schema changes, app runs, and read-only checks. Rotate those keys on a regular schedule using built-in cloud rotation rules. When the secret store updates a key, the next build pulls the fresh value. No person has to copy or paste the new password into the build tool.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Should we store static AWS keys in TeamCity root projects?

No, static keys in root projects are easy to leak across child builds. Use IAM roles on build agents or open identity tokens for short sessions.

How do we stop feature branches from reading production secrets?

Split your agents into separate pools for testing and production work. Assign a restricted cloud role to the test pool that blocks production secret names.

What happens if a build script echoes a secret to the log?

TeamCity masks values marked as passwords in the build log output. Still, you should turn off verbose shell printing in steps that handle keys.

The query runs. The emails stay hidden.