0

I've recently setup a Team City Cloud Agent on AWS EC2 for testing purposes. Everything is working great and the TeamCity server sees the new build server being spun up and pushes queues to them. However, I am having an issue when it comes to getting the new instances tagged upon creation. I created a couple of self-defined tags like Name, Domain, Owner, etc. I added those tags to the AMI that it's creating the build servers from and I have also given the ec2:*Tags permission to the AWS Policy. For some reason it's not tagging the servers upon creation, it just leaves everything blank. Is there something that I may not have configured or is this a functionality that it doesn't offer?

Also, is it possible to make the teamcity server assign a specific name to the build servers, like buildserver1, buildserver2 and so on?

Here is the policy I am applying on the TeamCity Cloud

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Stmt1469049271000",
        "Effect": "Allow",
        "Action": [
            "ec2:Describe*",
            "ec2:StartInstances",
            "ec2:StopInstances",
            "ec2:TerminateInstances",
            "ec2:RebootInstances",
            "ec2:RunInstances",
            "ec2:ModifyInstanceAttribute",
            "ec2:*Tags"
        ],
        "Resource": [
            "*"
        ]
    }
]

}

Thanks!

Nare
  • 43
  • 2
  • 7

1 Answers1

0

Why your tags are not appearing is probably a permissions problem. You should have an IAM policy that looks like this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1469498198000",
            "Effect": "Allow",
            "Action": [
                "ec2:*Tags"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Also, make sure to apply that policy to the server IAM role, not the agents.

For your second question, it's entirely possible to assign a name to a build agent:

inside <TeamCity Agent Home>/conf/buildagent.properties:

## The unique name of the agent used to identify this agent on the TeamCity server
name=buildserver1
spg
  • 9,309
  • 4
  • 36
  • 41
  • Thank you for the reply! I updated the above post with the policy that I am using. I am allowing ec2:*Tags and the resource is set to *. As far putting the name in the buildagent.properties, I know that I can edit it on the agent itself before starting the service but I was wondering if there's a way for the teamcity cloud agent to name them when it creates the servers, since it creates and deletes servers based on demand so I can physically go the conf file on the agent and change them since they may be delete at some point – Nare Jul 27 '16 at 18:42