AwsConnection

Stores information and configuration for the access to Amazon Web Services.

Example. Adds a new Connection that allows TeamCity to store and manage AWS Credentials (IAM User Access Key). When using Session Credentials, a new temporary Access Key will be generated each time this connection is used.

project {
// Other Project settings ...
features {
// Other Project Features ...
        awsConnection {
id = "AwsIamUser"
name = "AWS IAM User"
regionName = "eu-central-1"
credentialsType = static {
accessKeyId = "keyId"
secretAccessKey = "Link to credentialsJSON property containing AWS secret access key"
useSessionCredentials = true
}
stsEndpoint = "https://sts.eu-central-1.amazonaws.com"
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage AWS Credentials (IAM User Access Key). This connection can be used by subprojects.

project {
// Other Project settings ...
features {
// Other Project Features ...
        awsConnection {
id = "AwsIamUser"
name = "AWS IAM User"
regionName = "eu-central-1"
credentialsType = static {
accessKeyId = "keyId"
secretAccessKey = "Link to credentialsJSON property containing AWS secret access key"
}
allowInSubProjects = true
}
}
}

Example. Adds a new Connection that allows TeamCity to store and manage AWS Credentials (IAM User Access Key). This connection can be used in build steps.

project {
// Other Project settings ...
features {
// Other Project Features ...
        awsConnection {
id = "AwsIamUser"
name = "AWS IAM User"
regionName = "eu-central-1"
credentialsType = static {
accessKeyId = "keyId"
secretAccessKey = "Link to credentialsJSON property containing AWS secret access key"
}
allowInBuilds = true
}
}
}

Example. Adds a new Connection that allows TeamCity to assume an AWS IAM Role using another AWS Connection.

project {
// Other Project settings ...
features {
// Other Project Features ...
        awsConnection {
id = "AwsIamRole"
name = "AWS IAM Role"
regionName = "eu-central-1"
credentialsType = iamRole {
roleArn = "arn:aws:iam::account:role/role-name-with-path"
sessionName = "TeamCity-session-identifier"
awsConnectionId = "AwsIamUser"
}
stsEndpoint = "https://sts.eu-central-1.amazonaws.com"
}
}
}

Example. Adds a new Connection that allows TeamCity to look for credentials in the default locations on the TeamCity server machine using the Default Credentials Provider Chain.

project {
// Other Project settings ...
features {
// Other Project Features ...
        awsConnection {
id = "AwsDefaultCredsProviderChain"
name = "AWS Default Creds Provider Chain"
regionName = "eu-central-1"
stsEndpoint = "https://sts.eu-central-1.amazonaws.com"
credentialsType = default()
}
}
}

See also

Constructors

Link copied to clipboard
constructor(init: AwsConnection.() -> Unit)
constructor()

Types

Properties

Link copied to clipboard

Whether build steps can utilize the connection or not

Link copied to clipboard

Whether sub-projects can utilize the connection or not

Link copied to clipboard

The way how to obtain credentials (just provide the keys, assume IAM role or other)

Link copied to clipboard
var id: String?

Project feature id, if not specified will be generated

Link copied to clipboard
var name: String?

AWS connection display name

Link copied to clipboard
Link copied to clipboard

Custom identifier for this AWS Connection

Link copied to clipboard

Region where this connection will be used.

Link copied to clipboard

Endpoint from where to obtain session credentials

Link copied to clipboard

Project feature type

Functions

Link copied to clipboard
fun booleanParameter(customName: String? = null, trueValue: String? = "true", falseValue: String? = "false"): DelegateProvider<Boolean?>
Link copied to clipboard
fun clear()
Link copied to clipboard
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null): DelegateProvider<T>
Link copied to clipboard
fun <T : Parametrized> copyParamsTo(target: T): T

Copies parameters of this object to the specified target

Link copied to clipboard

Creates an instance of this project feature via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.

Link copied to clipboard

Looks for credentials in this order: Env Vars - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY Java System Properties - aws.accessKeyId and aws.secretKey Web Identity Token credentials from the environment or container Credential profiles file at the default location (~/.aws/credentials) Credentials delivered through the Amazon EC2 container service if AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable, Instance profile credentials delivered through the Amazon EC2 metadata service more: https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html

Link copied to clipboard
fun doubleParameter(customName: String? = null): DelegateProvider<Double>
Link copied to clipboard
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null): DelegateProvider<E>
Link copied to clipboard
fun findRawParam(paramName: String): Parameter?
Link copied to clipboard
fun hasParam(paramName: String): Boolean
Link copied to clipboard

Uses another (principal) AWS connection to assume an IAM Role with its permissions. Please, note that the principal connection should have rights to assume the role, more: https://docs.aws.amazon.com/workdocs/latest/developerguide/wd-iam-grantdev.html

Link copied to clipboard
fun intParameter(customName: String? = null): DelegateProvider<Int>
Link copied to clipboard
fun param(name: String, value: String)

Adds parameter with specified name and value

Link copied to clipboard
fun removeRawParam(paramName: String)
Link copied to clipboard
open fun stringParameter(customName: String? = null): DelegateProvider<String>
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun validate(consumer: ErrorConsumer)

Validates this object and reports found errors to the provided consumer