Setting Up TeamCity for Amazon EC2


TeamCity supports cloud build agents using Amazon EC2.
According to "Setting Up TeamCity for Amazon EC2" in TeamCity 8.x Documentation, "Since TeamCity 7.1, if EBS-based instance id is specified in the images  list, the instance is stopped instead."
I am using TeamCity Professional 8.0.5 (build 27692).
So, I typed a stopped EBS-based instance id in "Agent images and instances" of Agent Cloud Profile instead of AMI id.
At first, the instance started running when a build was added in Build Queue. After running timeout had been reached, it was stopped.
But, from that time, it did not start running even if another build had been added in Build Queue. The agent clould profile was tagged by "Image Error" that "Image does not exist in Amzon EC2". You can see it in the attached screenshot.

Since what I typed is not AMI id but instance id, the error message is right. But, if I type AMI id, TeamCity creates a new instance using it.
I want for TeamCity not to create a new instance with AMI id but to start running the stopped instance.

How can the same instance be used whenever a build is added in Build Queue?

Any suggestion will be appreciated. :)


Comment actions Permalink

When I typed EBS-based instance id as well as AMI id that had been made from the instance, TeamCity used the instance at the first build but created a new instance from the AMI from the second build.

Comment actions Permalink

At last, I found out a solution.
What is required is the AMI with which the EBS-based instance have been launched.

I deleted the AMI in Amazon Management Console after the EBS-based instance had been launched because it had a snapshot that spends some money. I thought that it was not necessary because TeamCity would not terminate the instance but stop it.
But, when TeamCity ccould not find the AMI in my Amazon account, it complained with the Image Error "Image does not exist in Amazon EC2."

The solution that I found out is as in the following:

I created a new AMI from the EBS-based instance on which I had installed a build agent. Then, terminating the instance, I launched a new instance from the AMI.
I typed only the new instance ID in "Agent images and instances" of "Cloud profile."
I did not type the AMI ID in "Agent images and instances" of "Cloud profile" but preserved the AMI in my Amazon account.

I hope that this be a help for someone who would be encountered with the "Image Error."


Please sign in to leave a comment.