Feature in beta mode. Please report all problem here
This feature auto manages EC2 Spot Fleet or ASG based Fleets for Jenkins based on label attached to Jenkins Jobs.
With this feature user of EC2 Fleet Plugin doesn't need to have pre-created AWS resources to start configuration and run Jobs. Plugin required just AWS Credentials with permissions to be able create resources.
- Plugin detects all labeled Jobs where Label starts from Name configured in plugin configuration
Cloud Name
- Plugin parses Label to get Fleet configuration
- Plugin creates dedicated fleet for each unique Label
- Plugin uses CloudFormation Stacks to provision Fleet and all required resources
- When Label is not used by any Job Plugin deletes Stack and release resources
Label format
<CloudName>_parameter1=value1,parameter2=value2
Note Parameter name is case insensitive
Parameter | Value Example | Value |
---|---|---|
imageId | ami-0080e4c5bc078760e |
Required AMI ID https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html |
max | 12 |
Fleet Max Size, positive value or zero. If not specified plugin configuration Max will be used |
min | 1 |
Fleet Min Size, positive value or zero. If not specified plugin configuration Min will be used |
instanceType | c4.large |
EC2 Instance Type https://aws.amazon.com/ec2/instance-types/. If not specified m4.large will be used |
spotPrice | 0.4 |
Max Spot Price, if not specified EC2 Spot Fleet API will use default price. |
Minimum configuration just Image ID
<FleetName>_imageId=ami-0080e4c5bc078760e
- Create AWS User. Alternatively, you can use an AWS EC2 instance role
- Add Inline User Permissions
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"cloudformation:*",
"ec2:*",
"autoscaling:*",
"iam:ListRoles",
"iam:PassRole",
"iam:ListInstanceProfiles",
"iam:CreateRole",
"iam:AttachRolePolicy",
"iam:GetRole"
],
"Resource": "*"
}]
}
- Goto
Manage Jenkins > Configure Jenkins
- Add Cloud
Amazon EC2 Fleet label based
- Specify
AWS Credentials
- Specify
SSH Credentials
- Jenkins need to be able to connect to EC2 Instances to run Jobs
- Set
Region
- Provide base configuration
- Note
Cloud Name
- Note
- Goto to Jenkins Job which you want to run on this Fleet
- Goto Job
Configuration
- Enable
Restrict where this project can be run
- Set Label value to
<Cloud Name>_parameterName=paremeterValue,p2=v2
- Click
Save
In some short time plugin will detect Job and will create required resources to be able run it in future.
That's all, you can repeat this for other Jobs.