All posts

The simplest way to make EC2 Instances TeamCity work like it should

You finally have your build agents humming along in TeamCity, but someone insists each job needs its own Amazon EC2 instance. You sigh, knowing what’s coming: credentials scattered across config files, ad-hoc SSH keys, and the creeping dread of manual security reviews. It doesn’t have to be this way. TeamCity is excellent at orchestrating builds and managing pipelines. EC2 shines at elastic compute, creating short-lived machines with just the right specs for the job. Together, they can deliver

Free White Paper

End-to-End Encryption + Sarbanes-Oxley (SOX) IT Controls: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

You finally have your build agents humming along in TeamCity, but someone insists each job needs its own Amazon EC2 instance. You sigh, knowing what’s coming: credentials scattered across config files, ad-hoc SSH keys, and the creeping dread of manual security reviews. It doesn’t have to be this way.

TeamCity is excellent at orchestrating builds and managing pipelines. EC2 shines at elastic compute, creating short-lived machines with just the right specs for the job. Together, they can deliver dynamic, isolated build environments that scale on demand. The trick is wiring identity and automation so you get both speed and control.

The key is letting TeamCity trigger, configure, and tear down EC2 instances automatically while AWS handles identity. Use IAM roles to attach permissions directly to your build agents, not to stored keys. When TeamCity starts a new build agent, it spins up an EC2 instance using those roles for access, then destroys it when finished. No keys, no leftovers. The build metadata stays inside TeamCity, and the infrastructure lifecycle belongs to AWS.

If you get weird timeouts or missing instance tags, check your agent templates first. Make sure the AWS autoscaling group uses on-demand or spot capacity correctly. Rotate credentials by assigning temporary STS tokens, not long-lived keys. Map TeamCity’s project permissions to the IAM roles linked with each build agent so one project can't accidentally deploy from another.

Quick answer: How do I connect EC2 Instances and TeamCity securely?
Create an IAM role with launch and terminate permissions, attach it to a TeamCity agent template, and use AWS API calls through the TeamCity cloud profile settings. The agent then authenticates automatically without using stored credentials, giving you secure, repeatable access at scale.

Continue reading? Get the full guide.

End-to-End Encryption + Sarbanes-Oxley (SOX) IT Controls: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Once configured properly, this setup delivers tangible benefits:

  • Faster build startup by using pre-baked AMIs tailored for your environment
  • Zero manual key management thanks to AWS IAM integration
  • Clean audit trails that satisfy SOC 2 and internal compliance
  • Elastic scaling during release rushes or test-heavy sprints
  • Consistent environments that mirror production, not stale containers

For developers, this feels liberating. No waiting for ops to approve new build nodes, no fiddling with config files. You push code, TeamCity spins compute. That rhythm keeps teams shipping instead of babysitting infrastructure. The developer velocity becomes obvious, especially when dozens of builds run concurrently across isolated instances.

Platforms like hoop.dev turn those access rules into guardrails that enforce policy automatically. They connect your identity provider, watch every request, and ensure your EC2 instances and TeamCity agents talk only when they should. It’s what happens when access control stops being a to-do list and starts being code.

AI-driven tools are already nudging this pattern further. Imagine an assistant that decides when to scale builds or retire agents based on commit patterns, reducing cost without touching a setting. When the identity layer is clean, automation becomes safe to trust.

EC2 Instances TeamCity integration is not about fancy cloud tricks. It’s about removing friction so builds start faster, stay secure, and disappear gracefully.

See an Environment Agnostic Identity-Aware Proxy in action with hoop.dev. Deploy it, connect your identity provider, and watch it protect your endpoints everywhere—live in minutes.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts