Unique identifier for EC2 instances?

We currently have a number of build agents running in EC2 which were manually configured and would like to start taking advantage of TeamCity's cloud features to reduce costs.

Each of our build agents has a few parameters defined in buildAgent.properties which have to be unique per build agent (to prevent parallel tests from interfering with each other).  It would be ideal to have a sequential index, but uniqueness should be sufficient.

It would be possible to have the build agents coordinate among themselves, but is there already something that fits this description?  Do cloud agents have ami-launch-index set in the meta-data, and if so, how does that behave over time as agents are stopped and started?

Comment actions Permalink

Hi Rick

There is better way to prevent parallel build execution. Groovy plugin allows to declare system.locks.writeLock.<lockName> parameter in a set of build configurations, and put all concurrent builds into a queue.

Comment actions Permalink


Sorry if I was unclear.  I do want things to build in parallel, I just want the different agents to talk to, e.g., different databases.  So, for example, agent-3 has "env.db.name = database_3" in its buildAgent.properties. TeamCity wants an AMI to launch build agents, so I can't bake the 3 into the AMI.  I can generate the necessary files on boot, but I'd need to know that this agent is the third one.

There are other ways to achieve the same effect, but if there's an index somewhere already that can be used, that would be easiest.

Comment actions Permalink


We have a feature reques to achieve alike functionality but on the build level rather then agent's level: TW-3798
The plugin Michael linked to has "locks" suport and it's code can be adapted to actually set different values into each starting build.

Do you actually need to manage the resources on the agent's level rather then build's?
If yes, then could you please detail why?


Please sign in to leave a comment.