3
votes

I am using Jenkins as the "glue" on my current project. It's being used for the usual continuous integration, with various test being ran and deployments made. I am using AWS to host the application and will eventually require a cluster of EC2 instances. The cluster instances will handle HTTP requests from the public. The instances won't just be for build processes.

What I would like to be able to do is have Jenkins handle the creation (and termination) of the EC2 instances. Not necessarily automatically. I want to kick off a job that creates an instance, registers the instance as a Jenkins slave, runs some jobs to install some tools on the instance, test the instance and then finally add it to my cluster to handle traffic.

I've tried setting this all up using standard shell commands in some jobs but it seems a bit fiddly and made me think that surely there must be a plugin for this.

I have installed and tested the Jenkins EC2 Plugin, which I must say is great, but doesn't quite fit my needs. For a start it seems to be mainly aimed at handling load for jenkins build jobs. It also doesn't really allow me to hook into the job and for example, automatically kick off my deploy & test jobs on the new instance.

Can anyone recommend a good method or plugin to handle the creation of EC2 instances?

Thanks

1

1 Answers

6
votes

Did you tried the Jenkins Cloudformation plugin? Cloudformation plugin for Jenkins

With this, you will be able to run a Cloudformation scripts as build step. The cloudformation script can contain many instructions, user data for the instances which makes you able to set up and configure the Jenkins slaves. The good part is that you can create a complex stack, you can generalise it with parameters. The plugin support the deletion of a stack, so it does a complete cleanup.