Spot Instances are really powerful for short term jobs that require specific resources which makes them perfect for Jenkins Agents. You can read about Spot Instances here. This Cloudformation template was designed for use with the Jenkins EC2-Fleet plugin.
On my Agents I enforce builds to occur in docker so that I don't need snowflake dedicated resources. In order to accomplish this I have the following requirements:
- Git
- Docker
- Java 1.8.0
I've parameterized most of the settings, though you might want to edit which instances are used (Line 159).
I set the weight of each Launch Configuration to 1 because each instance I've selected is around an on-demand cost of
Spot instance availability is per region, per AZ. All my instances in the example are in AZ A, but you should vary them both by AZ and instance type.