AmazonEC2CloudImage

open class AmazonEC2CloudImage : CloudImage
fun ProjectFeatures.amazonEC2CloudImage(init: AmazonEC2CloudImage.() -> Unit = {})

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 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
fun AmazonEC2CloudImage(init: AmazonEC2CloudImage.() -> Unit = {})

Types

Link copied to clipboard
inner class AMI(ami: String) : AmazonEC2CloudImage.Source
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

Functions

Link copied to clipboard
fun booleanParameter(    customName: String? = null,     trueValue: String? = "true",     falseValue: String? = "false"): SingleDelegateProvider<Boolean>
Link copied to clipboard
fun clear()
Link copied to clipboard
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null): CompoundDelegateProvider<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
open fun create(): ProjectFeature

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): SingleDelegateProvider<Double>
Link copied to clipboard
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null): SingleDelegateProvider<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): SingleDelegateProvider<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
fun stringParameter(customName: String? = null): SingleDelegateProvider<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

Properties

Link copied to clipboard
var agentPoolId: String?
Link copied to clipboard
var autoAssignPublicIP: Boolean?
Link copied to clipboard
var availabilityZone: String?
Link copied to clipboard
var customizeLaunchTemplate: Boolean?
Link copied to clipboard
var dedicatedHostsTags: Map<String, String>?
Link copied to clipboard
var ebsOptimized: Boolean?
Link copied to clipboard
var iamProfile: String?
Link copied to clipboard
var id: String? = null

Project feature id, if not specified will be generated

Link copied to clipboard
var instanceTags: Map<String, String>?
Link copied to clipboard
var instanceType: String?
Link copied to clipboard
var keyPairName: String?
Link copied to clipboard
var launchTemplateCustomAmi: String?
Link copied to clipboard
var maxInstancesCount: Int?
Link copied to clipboard
var name: String?
Link copied to clipboard
val params: List<Parameter>
Link copied to clipboard
var profileId: String?
Link copied to clipboard
var securityGroups: List<String>?
Link copied to clipboard
var source: AmazonEC2CloudImage.Source? = null
Link copied to clipboard
var spotInstanceBidPrice: Double?
Link copied to clipboard
var type: String

Project feature type

Link copied to clipboard
var userScript: String?
Link copied to clipboard
var useSpotInstances: Boolean?
Link copied to clipboard
var vpcSubnetId: String?