AmazonEC2CloudImage

Definition of a cloud image for a cloud profile agent cloud profile for AWS EC2 in a project.

Example. EC2 Cloud Image using an AMI with a VPC

project {
// Other Project settings ...
features {
// Other Project Features ...
        amazonEC2CloudImage {
name = "name"
profileId = "amazon-1"
source = AMI("ami-463edb31")
vpcSubnetId = "subnet-045436575f4ega1d5"
iamProfile = "some_iamProfile"
instanceType = "t2.nano"
}
}
}

Example. EC2 Cloud Image using an AMI with a VPC and image priority

project {
// Other Project settings ...
features {
// Other Project Features ...
        amazonEC2CloudImage {
name = "name"
profileId = "amazon-1"
source = AMI("ami-463edb31")
vpcSubnetId = "subnet-045436575f4ega1d5"
iamProfile = "some_iamProfile"
instanceType = "t2.nano"
imagePriority = 100
}
}
}

Example. EC2 Cloud Image using a specific Instance with a VPC, a key pair, optimized for ebs, with security groups, using spot instances and that injects a custom script on agent startup

project {
// Other Project settings ...
features {
// Other Project Features ...
        amazonEC2CloudImage {
name = "name"
profileId = "amazon-1"
source = Instance("ami-463edb31")
vpcSubnetId = "subnet-045436575f4ega1d5"
iamProfile = "some_iamProfile"
keyPairName = "some_kpname"
instanceType = "t2.nano"
ebsOptimized = true
securityGroups = listOf("sec1", "sec2")
userScript = "sh ~/custom_script.sh"
useSpotInstances = true
spotInstanceBidPrice = 5.0
instanceTags = mapOf("a" to "aa", "b" to "bb")
maxInstancesCount = 5
agentPoolId = "some_agent_pool"
}
}
}

Example. EC2 Cloud Image using a Spot Fleet config

project {
// Other Project settings ...
features {
// Other Project Features ...
        amazonEC2CloudImage {
name = "name"
profileId = "amazon-1"
source = SpotFleetConfig("""
{
"IamFleetRole": "arn:aws:iam::913206223978:role/aws-ec2-spot-fleet-tagging-role",
"AllocationStrategy": "priceCapacityOptimized",
"TargetCapacity": 1,
"TerminateInstancesWithExpiration": true,
"Type": "request",
"TargetCapacityUnitType": "units",
"SpotPrice": "183.3",
"LaunchSpecifications": [
{
"ImageId": "ami-0f31q9ce40194e750",
"KeyName": "key-pair",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"DeleteOnTermination": true,
"SnapshotId": "snap-0682e88d8f0cb1ee8",
"VolumeSize": 8,
"VolumeType": "gp2",
"Encrypted": false
}
}
],
"SubnetId": "subnet-01d36cf70ff187181",
"InstanceRequirements": {
"VCpuCount": {
"Min": 2
},
"MemoryMiB": {
"Min": 2048
}
}
}
]
}
""".trimIndent())
}
}
}

Constructors

Link copied to clipboard
constructor(init: AmazonEC2CloudImage.() -> Unit = {})

Types

Link copied to clipboard
Link copied to clipboard
object Companion
Link copied to clipboard
inner class Image(imageId: String) : AmazonEC2CloudImage.Source
Link copied to clipboard
inner class Instance(instanceId: String) : AmazonEC2CloudImage.Source
Link copied to clipboard
inner class LaunchTemplate(templateId: String, version: String = AmazonEC2CloudImage.DEFAULT_VERSION) : AmazonEC2CloudImage.Source
Link copied to clipboard
inner class PublicAMI(publicAMI: String) : AmazonEC2CloudImage.Source
Link copied to clipboard
open inner class Source(source: String)
Link copied to clipboard
inner class SpotFleetConfig(spotFleetConfig: String) : AmazonEC2CloudImage.Source

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var id: String?

Project feature id, if not specified will be generated

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var name: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Project feature type

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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
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
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