The ‘Run on AWS’ option for TeamCity available on the JetBrains site lets you run the TeamCity stack in AWS using the official CloudFormation template.
The stack includes:
- a CoreOS EC2 instance with the official TeamCity server of the specified version from Docker Hub
- one TeamCity Build Agent running as a separate container on the same instance.
- an RDS MySQL database
The official Docker images with the TeamCity server and build agent are used.
The server and the database are placed in their own VPC which is completely secure. The database allows only internal connections within the VPC and it’s possible to connect to the Server via HTTP(s) or SSH only.
To create a TeamCity stack and connect to it, you will need
an EC2 KeyPair in the same region as the TeamCity stack
an installed SSH client to connect to the TeamCity server and view the logs
1. Specify the parameters provided by the template:
The name for your TeamCity server, set to test by default
EC2 instance Type
Specify the type of instance for the TeamCity server EC2 instance
The existing EC2 KeyPair for SSH access to the TeamCity Server EC2 instance
By default, the template will create a TeamCity installation of the latest version. You can also specify the exact version number here, e.g. 2017.1.5, 2017.2
RDS Database Instance Type
Specify the type for the RDS MySQL instance used as the external database for TeamCity
TeamCity Database Password
Specify any password for the TeamCity database
2. Click Next. (Optional) In the dialog that appears, provide additional options if required.
3. Click Next, review your settings and click Сreate. No other actions are required. It takes about 15 minutes for the template to deploy the whole stack. Once the deployment is ready, you will see the TeamCity server endpoint in the Output section which points you to your TeamCity installation.
4. Access the TeamCity instance from your browser, create the administrator’s account and start using your TeamCity.
Connecting to server and viewing logs
To connect to the server’s console, you need to use your instance private key:
To see the teamcity-agent.log or teamcity-server.log, just run the
docker logs command for the desired container, e.g. for the server logs, run
Once you have TeamCity up and running, consider the following steps:
Use the EC2 integration to run and connect more build agents to your server
Configure TeamCity to use the S3 bucket as external artifact storage.
Upgrading TeamCity in AWS
To update TeamCity started from the CloudFormation template:
You will be redirected to the Select Template page: use the Current Template option and click Next.
On the template settings page, enter the TeamCity version you want to update to. Note that if you previously used the TeamCity version tagged ‘latest’, you will now need to provide the actual version number as the "latest" tag can be applied to the server only once.
Click Next, provide additional options if required, review the new settings and click Update. Once the Update is complete, access the TeamCity Web UI from the browser.
Wait for the server to upgrade, log in to the TeamCity server and wait for the agent to upgrade and connect to the server.