<p>We use AWS's <a href="https://wiki.jenkins.io/display/JENKINS/Amazon+EC2+Plugin" rel="nofollow noreferrer">EC2 Plugin</a> to spin up spot instances in AWS for our Jenkins master based on a single AMI, exactly as you describe, so Jenkins does support this behavior.</p>

<p>From a quick bit of searching Google Cloud seems to offer <a href="http://blog.spotinst.com/2016/08/31/elastigroup-jenkins-plugin-google-cloud-platform/" rel="nofollow noreferrer">a similar solution</a>; </p>

<blockquote>
  <p>Spotinst’s Jenkins Plugin helps you to do more with your Jenkins setup by allowing you to automatically configure and scale a designated Google Compute Engine Preemptible VM as Slaves up and down depending on the number jobs to be completed.</p>
</blockquote>

CC BY-SA 3.0
2018-04-17T13:59:11.170Z
2018-04-17T13:59:11.170Z
Alex
<p>Google just announced this <a href="https://plugins.jenkins.io/google-compute-engine" rel="nofollow noreferrer">Jenkins plugin for GCE</a> , which does support autoscaling.</p>

CC BY-SA 4.0
2018-05-11T08:54:15.683Z
2018-05-11T08:54:15.683Z
Joshua Fox
<p>To save money, I would like a large number of agent machines to be stopped and started up only when needed. Better yet, a single  VM should be copied and launched on demand.</p>

<p>I am using Google Cloud Platform.</p>

<p>I see the  <a href="https://plugins.jenkins.io/kubernetes" rel="nofollow noreferrer">Kubernetes plugin</a>, used in Jenkins X, as well as the  <a href="https://wiki.jenkins.io/display/JENKINS/VirtualBox+Plugin" rel="nofollow noreferrer">VirtualBox Plugin</a>, but I get the sense that Jenkins might not be designed for this. </p>

<p>What is the standard way, if any, to do this?</p>

CC BY-SA 3.0
2018-04-15T21:28:56.650Z
`but I get the sense that Jenkins might not be designed for this`. Please explain why.
030
CC BY-SA 3.0
2018-04-16T04:07:45.630Z
Because I find very little info on the Web about how to do it. If autostart  were a standard approach, the documents about setting up the agent would include it as a basic case.
Joshua Fox
CC BY-SA 3.0
2018-04-16T05:52:53.240Z
https://stackoverflow.com/questions/40050127/is-possible-for-jenkins-to-auto-start-and-stop-slave-nodes
030
CC BY-SA 3.0
2018-04-16T06:37:02.137Z
Thank you. From the discussions online, it seems that  the most usual way to use Jenkins is to keep a constant number of slave VMs running.
Joshua Fox
CC BY-SA 3.0
2018-04-16T07:25:27.810Z
Perhaps Jenkins x provides a solution, but I have not tried. I hope that start with that the upcoming days. Did you already deploy Jenkins x?
030
CC BY-SA 3.0
2018-04-16T08:37:11.567Z
I have not tried Jenkins X.
Joshua Fox
CC BY-SA 3.0
2018-04-16T08:37:35.233Z
Also, this describes how to create ephemeral; agents  in GCE https://cloud.google.com/solutions/using-jenkins-for-distributed-builds-on-compute-engine
Joshua Fox
<jenkins><kubernetes><google-cloud-platform><virtualization><google-compute-engine>
How do I autostart Jenkins agent machines?
Joshua Fox
# How do I autostart Jenkins agent machines?

(Asked by: username_0 on 2018-04-15)

To save money, I would like a large number of agent machines to be stopped and started up only when needed. Better yet, a single VM should be copied and launched on demand.

I am using Google Cloud Platform.

I see the [Kubernetes plugin](https://plugins.jenkins.io/kubernetes), used in Jenkins X, as well as the [VirtualBox Plugin](https://wiki.jenkins.io/display/JENKINS/VirtualBox+Plugin), but I get the sense that Jenkins might not be designed for this.

What is the standard way, if any, to do this?

**Tags:** jenkins, kubernetes, google-cloud-platform, virtualization, google-compute-engine

> **Comments:**
> **username_1**: `but I get the sense that Jenkins might not be designed for this`. Please explain why.  
> **username_0**: Because I find very little info on the Web about how to do it. If autostart  were a standard approach, the documents about setting up the agent would include it as a basic case.  
> **username_1**: https://stackoverflow.com/questions/40050127/is-possible-for-jenkins-to-auto-start-and-stop-slave-nodes  
> **username_0**: Thank you. From the discussions online, it seems that  the most usual way to use Jenkins is to keep a constant number of slave VMs running.  
> **username_1**: Perhaps Jenkins x provides a solution, but I have not tried. I hope that start with that the upcoming days. Did you already deploy Jenkins x?  
> **username_0**: I have not tried Jenkins X.  
> **username_0**: Also, this describes how to create ephemeral; agents  in GCE https://cloud.google.com/solutions/using-jenkins-for-distributed-builds-on-compute-engine  

---

## 2 answers

### Answer by username_2 on 2018-04-17. Score: 1

We use AWS's [EC2 Plugin](https://wiki.jenkins.io/display/JENKINS/Amazon+EC2+Plugin) to spin up spot instances in AWS for our Jenkins master based on a single AMI, exactly as you describe, so Jenkins does support this behavior.

From a quick bit of searching Google Cloud seems to offer [a similar solution](http://blog.spotinst.com/2016/08/31/elastigroup-jenkins-plugin-google-cloud-platform/);

> Spotinst’s Jenkins Plugin helps you to do more with your Jenkins setup by allowing you to automatically configure and scale a designated Google Compute Engine Preemptible VM as Slaves up and down depending on the number jobs to be completed.


---

### Answer by username_0 on 2018-05-11. Score: 0

Google just announced this [Jenkins plugin for GCE](https://plugins.jenkins.io/google-compute-engine) , which does support autoscaling.


---

