Tagging EC2 build agents

I'm experimenting with running TeamCity in AWS and I've created a couple of agent AMIs for different build profiles we have.  Here's my problem, our corp IT wants us to have certain tags on our instances (for various reasons including billing).  I've tried setting tags on the AMI itself but when TC spins up an instance, there are no tags.  Do I have any options for having it assign tags for me?

Thanks,
tim

5 comments
Comment actions Permalink

Hi Tim,

TeamCity does not have an option to tag your instances automatically.  I would suggest either using one of the AWS SDKs or AWS Command line tools and tag them programatically when the instance comes up.  You can put this into an /etc/init.d/ script and then have a set of aws keys on the ami that has the ability to tag.  It should be fairly easy to do.  Good luck!

- Jay

0
Comment actions Permalink

Yeah I thought about that.  The thing I didn't like about that solution is that it's deeply embedded and not easily changed.  Our internal tagging scheme is out of our hands and I could easily see our ops group changing that scheme down the road.  And should that happen, redoing an AMI isn't exactly a snap with AWS.  I think for now I'm just going to have a pool of (property tagged) instances that TC can spin up when it needs them.  Not ideal but it'll work for now.

0
Comment actions Permalink

You could always have a remote server that serves up the value and that is where you update it, if you use Chef it could be stored there or put it in a file in s3.  This way you can update it on the fly and then all new instances get the new tag.

0
Comment actions Permalink

One thought... at the very least, it would be nice if TC would at least let me specify User Data that could be used when starting an instance.  That would be very helpful here.

0

Please sign in to leave a comment.