6 Deploying HA Jenkins on multiple cloud providers

This chapter covers

  • Automating the build process of Jenkins VMs with Packer
  • Deploying a Jenkins cluster on Azure, GCP, and DigitalOcean
  • Reducing the cost of deploying Jenkins workers by creating them on demand
  • Using the same Packer template to create identical Jenkins machine images in different cloud providers

You’ve already seen how to accomplish fault tolerance by deploying the Jenkins cluster in AWS. The chapter will try to achieve the same required speed and automation on the infrastructure level by using the same tools and processes to automate the creation of a cluster on different cloud providers such as Microsoft Azure, Google Cloud Platform, and DigitalOcean—ranging from infrastructure-as-a-service (IaaS) to platform-as-a-service (PaaS) providers.

You might notice that some parts of this chapter are similar, or even the same as, those you read in the previous chapter. The reason for the partial repetition is to achieve the goal of this book, which is to illustrate the use of Jenkins with cloud-native applications—and because not everyone is adopting AWS as their main cloud provider, I want to make this book useful for others and for those who skipped chapter 5 and jumped right here.


Using the providers detailed in this chapter carries some benefits and drawbacks. No matter which provider you choose, you'll always encounter issues at some point along the way.

6.1 Google Cloud Platform

6.1.1 Building Jenkins VM images

6.1.2 Configuring a GCP network with Terraform

6.1.3 Deploying Jenkins on Google Compute Engine

6.1.4 Launching automanaged workers on GCP

6.2 Microsoft Azure

6.2.1 Building golden Jenkins VM images in Azure

6.2.2 Deploying a private virtual network

6.2.3 Deploying a Jenkins master virtual machine

6.2.4 Applying autoscaling to Jenkins workers

6.3 DigitalOcean

6.3.1 Creating Jenkins DigitalOcean Snapshots