Never Deploy Backup Proxies Manually Again With Infrastructure as Code!
My recent obsession with automation and Infrastructure as Code in general has resulted in a lot of efficiencies in my day to day work life. Where I used to deploy Windows Templates manually through vSphere, I now use Terraform to handle repeatable deployments of lab server instances. I use Ansible and Chocolatey to install and configure key applications and my PowerShell scripts have become more complex and evolved than ever before. When it comes to automating the deployment of Veeam Backup & Replication and it’s components, there are a few projects that I’ve worked on over the last 18-24 months such as the VMware Cloud on AWS SDDC Autodeploy and vCloud Director NSX Edge Configuration for Cloud Connect Replication with Terraform and various other bits of coding tools to help in my day to day.
Automation is all about problem solving… taking a mundane manual task and making it easier to execute consistently and having that process be repeatable. From there we can leverage it to help solve other issues such as scaling or more inventive ways of going about things. This was the essence for this project, to use Infrastructure as Code to deploy and configure Veeam Components and specifically in this case apply it to one of the areas where repeatable, automated deployments can help with deploy and scale for Veeam customers and partners… that is the Backup Proxy.
Introducing Project Ōtosukēru
The initial aim of this project was to have Veeam Proxies automatically deployed and configured for ephemeral use by Veeam Backup & Replication jobs. It has the ability to deploy Veeam Backup Proxy VMs to vSphere and configures them in Veeam Backup & Replication and also the ability to remove the configuration and destroy the VMs. A pre and post script can be configured within the Veeam Job and run every-time the job is executed. As the scope of the project grew, the focus shifted to the ability to deploy Veeam Proxies automatically, but then have the ability to scale the number up or down dynamically. It also has the ability to deploy and scale new NAS File Proxies.
There is a master PowerShell script that executes all the code and does the following:
- Connects to a Veeam Backup & Replication Server
- Gets all Backup Jobs and derives the number of VMs total being backed up
- Option exists for HCI deployments to set Proxy count to number of hosts
- Option exists to set number of proxies when executing script allowing for auto scale
- Works out how many Veeam Proxies to deploy and sets that as a proxy count value
- Works out if set proxy count means a scale up or scale down
- Executes Terraform apply using the proxy count value
- Terraform deploys Proxies VM to vCenter, configures VM (DHCP Optional), and adds GustOS to domain or to a Workgroup
- PowerShell adds Proxies to Backup & Replication
- PowerShell then removes Proxies from Backup & Replication
- Destroys the Proxy VMs with Terraform
Video Walkthrough and Demo
Tools and Platforms Used
- Veeam Backup & Replication
- VMware vSphere
- Configuring Proxies to only be Deployed and in use during the duration of a Veeam Backup or Replication Job
- Easy initial deployment and configuration of Veeam Windows or Linux Proxies Backup and NAS File Proxies
- Scaling up or down on demand of Veeam Windows or Linux Backup Proxies and NAS File Proxies
This has been a really enjoyable project for me, and I have used it as a way to try and become better at PowerShell scripting and coding in general. More importantly, I believe it serves as a great example as to what can be done when you look outside the box at a particular situation and leverage new techniques to achieve an outcome. For those who manage Veeam environments I believe the Project will add some value to your environment and if nothing else, you are able to get inspiration at to how you can start to automate your Veeam and other environments.
My ask is that as many people try it out and provide feedback. This will only make the Project to get better the more people use it and more feedback it gets. Ideally I would like to know how the initial setup goes, and if anyone runs into any bugs or errors. There will be a few… I got a lot better at error trapping, but it’s still not perfect.
Clone/Fork it below… steal, borrow, reuse and enhance!