Amazon EC2Cloud Image
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"
}
Content copied to clipboard }
}
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
}
Content copied to clipboard }
}
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"
}
Content copied to clipboard }
}
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())
}
Content copied to clipboard }
}
Types
Properties
Functions
Copies parameters of this object to the specified target
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.
Validates this object and reports found errors to the provided consumer