TeamCity Support for AWS EC2 Container Service
TeamCity has been able to run build agents on AWS EC2 instances for ages.
In addition to this, the new plugin for TeamCity, Amazon ECS Support, allows running Docker-based build agents in an EC2 Container Service cluster.
The plugin is compatible with TeamCity 2017.1.x and later.
First, download the plugin and install it on the TeamCity server as usual.
Next, create a cloud profile in your project
Specify the AWS region and enter credentials to access AWS API and test your connection.
To make the plugin work, the provided credentials need the IAM role with the following permissions granted:
Finally, create a cloud image which will correspond to the build agent configuration you need by specifying the task definition, cluster to run build agent tasks, and agent pool for your agents.
In contrast to using EC2 as a cloud provider (which allows using almost infinite computation resources with no additional configuration required), using the TeamCity ECS plugin in production requires the ECS cluster to be configured properly.
The following aspects should be considered:
- Cluster capacity (cpu, disk)
- Cluster scale in and scale out
- Build agent logs collecting
To make it a bit easier, we’ve published the Terraform template we are using on our side to set up the infrastructure for TeamCity TestDrive build agents.
Even when configured properly, the ECS cluster will likely be limited in terms of available resources. So, when TeamCity tries to start one more cloud build agent in the cluster, there might be no CPU or RAM available. You can specify the “Max cluster CPU reservation” percentile in the cloud image to make TeamCity stop running new cloud agents when the CPU reservation limit is reached. This requires the additional AIM role: cloudwatch:GetMetricStatistics.
Feel free to download the plugin and try it on your server, or give the plugin a test drive in the cloud. Please share your feedback with us!
Happy building with TeamCity!
Subscribe to Blog updates
Thanks, we've got you!