Deploying 20 CentOS VMs in 4 Minutes!
I recently started to toy around with scenarios that required me to deploy multiple duplicates of the same CentOS Virtual Machine configuration. Working on this scenario got me curious. So I decided to build a template that would allow me to deploy 20 CentOS Virtual Machines each with one 1TB data disk and one public IP addresses.
To my surprise, deploying these 20 Standard A1 CentOS Virtual Machines on Microsoft Azure took 4 minutes!
Building the ARM Template
Let’s start by taking a CentOS ARM Template from a previous post. It will be our starting point for this exercise. Now, let’s removed the extra data disk and removed the Custom Script for Linux Virtual Machine Extension.
To duplicate a resource, we must use the copy operation. It enables us to use an index number or to iterate through an array of values that can be used when deploying a resource.
In this specific scenario, we want all our Virtual Machines to belong to the same Virtual Network and Subnet. Therefore, we need to duplicate each Virtual Machine, their Network Interface Cards (NIC) and their Public IP Addresses.
The following template, demonstrates the use of copyIndex() and concat(), to generate predictable identifiers for each copy. Continue Reading…