You know the definition of IaaS, its pieces, and who offers them. It is time to answer the practical question: what is IaaS used for in real companies? The quick answer, "to move servers to the cloud", is true but incomplete. IaaS shines in very different situations: test environments that exist for only a few hours, standby sites that cost little until the day they are needed, massive calculations over a weekend, or virtual desktops for working from anywhere. And there are also cases where IaaS is the wrong option because a PaaS or SaaS service would do the same with far less work. In this lesson we will analyse the most common use cases, with criteria for when to use them and when not to, we will summarise them in a table with alternatives, and we will apply them to three specific Hortalia cases: the ERP migration, a test environment that is only switched on during office hours, and disaster recovery for the ERP in another region.
- Lift and shift of legacy applications
What it is: moving an existing application to VMs in the cloud without modifying it (or with minimal changes), replicating in the cloud the server it had in its data center. It is also known as rehosting.
When to do it:
- The application comes from an external vendor and you cannot touch its code.
- There is urgency: the data center contract is ending, hardware is obsolete, failure is imminent.
- You want a low-risk first step, leaving modernisation for later.
When not to:
- The application already exists as SaaS with equivalent functionality and the company is willing to adapt its processes.
- It is your own code that could run on PaaS with little effort: moving it to a VM perpetuates the work of administering operating systems.
- The application is so badly sized or so inefficient that in the cloud, where everything is paid for by usage, it would cost more than at home.
Lift and shift is only one of the possible migration strategies; the full catalogue of strategies and how to choose between them is studied in Cloud Migration: Strategies and Vendor Lock-in.
- Ephemeral development and test environments
What it is: creating complete environments (VMs, networks, databases) to develop or test and destroying or switching them off when they are not in use. It is probably the case where pay-per-use is most noticeable.
When to do it:
- Testing updates (of the operating system, of the application) before applying them in production.
- Training, demonstrations, one-off load tests.
- Teams that need several environments in parallel (one per project or per version).
When not to:
- If the environment is left running 24/7 and nobody switches it off, the financial advantage is lost.
- If what is being tested is a modern web application, a PaaS can create test environments for every code change without managing VMs.
Key points: automate the creation (Infrastructure as Code, which we will see in 02-05), switch off outside working hours, and use the free editions for development where they exist (such as SQL Server Developer).
- Disaster recovery and backups
What it is: using the cloud as a second site where you keep backups and, if a disaster strikes the main site (fire, flood, ransomware, a regional outage), bring the systems up there.
Two metrics define any recovery plan:
- RPO (Recovery Point Objective): how much data you can afford to lose, measured in time. An RPO of 1 hour means that, after the disaster, the data will be recovered as it was at most 1 hour earlier.
- RTO (Recovery Time Objective): how long the service can be down before it is recovered.
When to do it: almost always. Before the cloud, a second data center was within reach of few companies; in IaaS, a standby site costs very little while it is not in use, because the VMs either do not exist or are switched off: you only pay for the backups and, depending on the strategy, replicated disks.
When not to (or with caveats): if the application is SaaS, recovering the infrastructure is the provider's business (although backups of your data are still your responsibility, as we saw in 01-05).
- Spiky workloads, batch processing, and HPC
What it is: workloads that need a lot of capacity for a short time: month-end calculations, rendering, scientific or engineering simulations (HPC, high-performance computing), training AI models, processing large batches of files.
When to do it:
- The capacity needed at the peak is far above the average: buying it would mean tying up money to use it on a handful of days.
- The work can be split up and repeated if it fails, which makes it possible to use spot VMs with large discounts.
- Specialised hardware (GPUs, low-latency networks between nodes) is only needed temporarily.
When not to:
- If the workload is steady and continuous, there is no peak and elasticity adds nothing.
- To orchestrate batches, a managed service (Azure Batch, AWS Batch, Google Cloud Batch) is usually preferable, as it creates and destroys the VMs for you. It is still IaaS underneath, but you do not have to program the machine management.
- Workloads with specific operating system or licensing requirements
What it is: applications that demand a specific operating system, an old version, special drivers, administrator access, or a particular licensing configuration (for example, tied to a number of cores or to a MAC address).
When to do it: when the vendor only certifies one combination of operating system and database, when the application needs Windows services, agents, or registry settings that no PaaS allows, or when the license requires dedicated hosts.
When not to: if the dependency on the operating system is just habit and not a requirement, or if the operating system is out of support: taking an unpatched Windows to the cloud does not make it any safer.
- Virtual desktops (VDI)
What it is: running users' desktops (Windows with their applications) on cloud VMs, accessed from any device. Current solutions range from building your own VDI on VMs to managed services such as Azure Virtual Desktop, Amazon WorkSpaces, or Windows 365 (the latter a cloud desktop per user per month, closer to SaaS).
When to do it: remote work with heavy desktop applications, temporary staff who need a controlled environment, applications that cannot be installed on personal devices, requirements that data must not leave the data center.
When not to: if the applications employees use are already web-based or SaaS, a VDI adds cost and complexity for no reason.
- Analytics and big data on virtual machines
What it is: installing and operating data processing platforms on VMs (Spark or Hadoop clusters, analytical databases, search engines) with full control of versions and configuration.
When to do it: when a specific version or configuration is needed, when an existing cluster is migrated as it is, or when there are control requirements a managed service does not meet.
When not to: in most new projects, managed services (Azure Databricks, Microsoft Fabric, Amazon EMR, Google Dataproc, or BigQuery) save a lot of operational work. Building Spark on VMs only pays off with a good reason.
- Summary table: case, why IaaS, and alternatives
| Use case | Why IaaS | PaaS/SaaS alternative to consider |
|---|---|---|
| Lift and shift of a legacy application | Does not require touching the application; full control of the OS | An equivalent SaaS version of the application; a managed database (e.g. Azure SQL Managed Instance) |
| Development and test environments | Faithful replicas of production created and destroyed on demand | Preview environments of an application PaaS |
| Disaster recovery | A cheap standby site while it is not in use | Managed replication services (Azure Site Recovery, AWS Elastic Disaster Recovery); SaaS with high availability included |
| Peaks, batches, and HPC | Massive temporary capacity, spot VMs, GPUs | Managed batch services (Azure Batch, AWS Batch, Google Cloud Batch); serverless functions for small tasks |
| OS or licensing requirements | You choose exactly the image and the configuration | Normally none, unless the vendor offers SaaS |
| VDI | Full Windows desktops in the cloud | Windows 365 (per user/month); web or SaaS applications that remove the need for a desktop |
| Analytics and big data | Full control of versions and configuration | Azure Databricks, Microsoft Fabric, Amazon EMR, Dataproc, BigQuery |
A practical rule follows from the table: IaaS is the right option when you need the control it offers or when you cannot change the application. If neither of those two reasons applies, check the alternatives column first.
- Hortalia, case 1: the ERP lift and shift
We already know the first case: moving the ERP from the cabinet to vm-erp-01, in the architecture we designed in IaaS Components. Laura organises the work in phases:
flowchart LR
A["1. Prerequisites<br/>second line, vendor<br/>support, quotas"] --> B["2. Build the foundation<br/>network, NSG, VPN,<br/>backup storage"]
B --> C["3. Pilot<br/>VM with a copy of the DB,<br/>key users test it"]
C --> D["4. Cutover<br/>weekend: final backup,<br/>restore, change DNS"]
D --> E["5. Stabilisation<br/>old server switched off<br/>but intact for 30 days"]
Key points of each phase:
- Prerequisites: the second fibre line from another operator (without it, an outage leaves the warehouse without an ERP); written confirmation from the ERP vendor that it supports Azure with Windows Server 2022 and SQL Server 2022; enough vCPU quota.
- Build the foundation: the network and VPN from 02-02, ideally with Infrastructure as Code.
- Pilot: restore a recent copy of the database on the VM and ask three key users (warehouse, purchasing, and invoicing) to work with it for a day. Performance is measured with real users over the VPN.
- Cutover: on a weekend, the old ERP is stopped, a final backup is taken, restored on
vm-erp-01, and theerp.hortalia.internalrecord is changed to point at10.20.1.10. Thanks to the DNS name, the workstations do not need reconfiguring. - Stabilisation: the old server is left switched off but intact for 30 days as a rollback plan.
- Hortalia, case 2: a test environment during office hours
The ERP vendor publishes updates several times a year, and until now Laura installed them straight into production with her fingers crossed. In the cloud she can have a permanent test environment that only consumes compute when it is in use:
- VM:
vm-erp-pruebas, sizeStandard_D2s_v5(2 vCPUs, 8 GB), enough for testing with a few users. - Software: Windows Server 2022 with SQL Server 2022 Developer, free for development and testing.
- Location: resource group
rg-hortalia-erp-pruebas, its own network10.30.0.0/16(the range reserved for testing in 02-02). We will create it with Terraform in Automating IaaS: Infrastructure as Code. - Schedule: running Monday to Friday from 08:00 to 18:00; deallocated the rest of the time. The VM carries the
horario=laboraltag, which the automation script will use.
10.1 The quick option: auto-shutdown
Azure includes a daily auto-shutdown feature that deallocates the VM at a fixed time:
az vm auto-shutdown \
--resource-group rg-hortalia-erp-pruebas \
--name vm-erp-pruebas \
--time 1600az vm auto-shutdown: configures the shutdown schedule of a VM.--time 1600: the shutdown time in HHMM format and in UTC. 16:00 UTC is 18:00 in mainland Spanish summer time (and 17:00 in winter). Entering the local time is a very frequent mistake.
It is a good safety net, but it only switches off: it does not start the VM in the morning.
10.2 The complete option: scheduled start and stop
Laura writes a small script that starts or deallocates every VM in the test group carrying the horario=laboral tag:
#!/usr/bin/env bash
# horario-pruebas.sh - starts or deallocates the VMs with the horario=laboral tag
# Usage: ./horario-pruebas.sh start | deallocate
set -euo pipefail
ACTION="${1:?Usage: $0 start|deallocate}"
RG="rg-hortalia-erp-pruebas"
# IDs of the VMs in the group with the horario=laboral tag
IDS=$(az vm list --resource-group "$RG" \
--query "[?tags.horario=='laboral'].id" --output tsv)
if [ -z "$IDS" ]; then
echo "There are no VMs with the horario=laboral tag in $RG"
exit 0
fi
case "$ACTION" in
start) az vm start --ids $IDS --no-wait ;;
deallocate) az vm deallocate --ids $IDS --no-wait ;;
*) echo "Invalid action: $ACTION"; exit 1 ;;
esac
echo "$(date '+%F %T') - $ACTION sent to:"
echo "$IDS"Explanation, block by block:
#!/usr/bin/env bash: says that the file is run with bash.set -euo pipefail: strict mode.-estops the script if a command fails;-uraises an error if an undefined variable is used;-o pipefailmakes a pipe fail if any of its parts fails. It stops an automation script from carrying on "blindly" after an error.ACTION="${1:?Usage: ...}": stores the first argument (startordeallocate); if none is passed, it shows the usage message and exits.az vm list ... --query "[?tags.horario=='laboral'].id": lists the VMs in the group and, with JMESPath, filters ([? ... ]) those that have thehorariotag with the valuelaboral, returning only their full identifier (.id).--output tsvproduces plain text, one ID per line.if [ -z "$IDS" ]: if the list is empty (-z), there is nothing to do and the script ends without an error.case ... esac: depending on the action, it runsaz vm startoraz vm deallocateon all the VMs at once with--ids.$IDSgoes without quotes on purpose, so that each ID is passed as a separate argument.--no-waitavoids waiting for them to finish (starting a Windows VM takes a couple of minutes).- The last part leaves a log line with the date and the VMs affected.
To run it automatically, Laura schedules it with cron on a small Linux administration machine, configured with the Madrid time zone. The identity the CLI authenticates with on that machine has a custom role that only allows reading, starting, and deallocating VMs in rg-hortalia-erp-pruebas (least privilege: if someone stole those credentials, they could not create or delete anything).
# Minute Hour Day Month Weekday Command 50 7 * * 1-5 /opt/hortalia/horario-pruebas.sh start >> /var/log/horario-pruebas.log 2>&1 0 18 * * 1-5 /opt/hortalia/horario-pruebas.sh deallocate >> /var/log/horario-pruebas.log 2>&1
- Each
crontabline has five time fields and the command.50 7 * * 1-5means "at 07:50, any day of the month, any month, from Monday (1) to Friday (5)". It starts at 07:50 so the VM is ready by 08:00. >> /var/log/horario-pruebas.log 2>&1: appends the standard output and the errors (2>&1) to the log file, so you can review what happened.
For production, Laura notes an alternative with no servers and no credentials to look after: an Azure Automation runbook (or Microsoft's Start/Stop VMs solution) that runs with a managed identity. In PowerShell, the core would be:
Connect-AzAccount -Identity
Get-AzVM -ResourceGroupName "rg-hortalia-erp-pruebas" |
Where-Object { $_.Tags["horario"] -eq "laboral" } |
Stop-AzVM -Force -NoWaitConnect-AzAccount -Identity: authenticates with the Automation account's managed identity, without passwords.Get-AzVM ... | Where-Object {...}: gets the VMs in the group and filters those with thehorario=laboraltag.Stop-AzVM -Force -NoWait: stops them by deallocating them (the default behaviour ofStop-AzVM), without asking for confirmation and without waiting.
Keeping the auto-shutdown from 10.1 alongside the script is good practice: if the script failed, the VM would be switched off anyway.
10.3 Estimating the saving
With illustrative figures for vm-erp-pruebas (Windows included, SQL Server Developer with no license cost): €0.20 per hour of compute and €20 a month for its two Standard SSD disks.
| Item | Running 24/7 | Office hours |
|---|---|---|
| Compute hours per month | 730 | ≈ 220 (10 h × 22 working days) |
| Compute | €146 | €44 |
| Disks (always billed) | €20 | €20 |
| Monthly total | €166 | €64 |
| Saving | €102/month (≈ 61%), around €1,224/year |
Two observations: the saving on compute is 70%, but the total falls by 61% because the disks are billed even when the VM is deallocated; and in August, with the warehouse ticking over, or on public holidays, Laura can leave the VM deallocated all day and save even more. If she had used SQL Server Standard with the license included instead of Developer, the hourly cost would have been considerably higher, with no benefit at all for testing.
- Hortalia, case 3: disaster recovery for the ERP
vm-erp-01 lives in one zone of spaincentral. A hardware fault is handled by Azure restarting it on another server; an outage of the zone or of the whole region is not. Laura sets the objectives with management:
- Target RPO: 1 hour. The transaction log backups every 30 minutes (from 02-02) meet it with room to spare.
- Target RTO: 8 hours. Losing a working day is acceptable; losing a week is not.
11.1 Disaster recovery strategies
| Strategy | How it works | Typical RTO | Cost while there is no disaster |
|---|---|---|---|
| Backup and restore | Only backups are kept in another region; in case of disaster the infrastructure is created and they are restored | Hours | Very low: storage only |
| Pilot light | Data is replicated continuously; the target VM does not exist or is switched off | Tens of minutes to a few hours | Low to medium: disk replica |
| Warm standby | A reduced environment is always running in the other region | Minutes | Medium to high: a VM running 24/7 |
| Active-active | Both regions serve traffic at the same time | Almost zero | High; besides, the application must support it |
With an RTO of 8 hours, backup and restore is enough and is the cheapest. As a next step, if the business asked for a shorter RTO, Laura could enable Azure Site Recovery, which continuously replicates the VM's disks to another region (pilot light).
11.2 The design
- Recovery region:
francecentral(Paris). Azure does not have a second region in Spain, and Paris offers low latency from Madrid and stays within the EU. Instead of relying on the paired region Azure assigns by default (not every new region has one), Laura explicitly chooses the destination. - Backups in the recovery region: a second storage account,
sthortaliaerpdr, infrancecentral, also with immutability. A separate process, with its own identity, copies each new backup fromsthortaliaerpcopiasthere (through object replication or a scheduled copy with AzCopy). That way, neither the ERP server nor whoever compromises it can delete either of the two. - Infrastructure ready to be recreated: the network, the NSG, and the VM defined as code (02-05) make it possible to bring them up in
francecentralby changing the region and the network range (10.21.0.0/16, so they do not overlap). - Optional third copy at another provider: the
hortalia-erp-copiasbucket in Amazon S3 that Laura designed in 01-05 fits as a copy outside Azure, following the 3-2-1 rule (three copies, on two different media, one off the main site). Laura notes it down for module 5.
The recovery procedure is documented like this:
sequenceDiagram
participant L as Laura
participant TF as Infrastructure as code
participant FR as Azure francecentral
participant ST as sthortaliaerpdr
participant ALM as Warehouse
L->>L: Declare a disaster (with management)
L->>TF: Apply the configuration with the francecentral region
TF->>FR: Create the network, NSG, VPN Gateway, and ERP VM
L->>ST: Fetch the latest full backup and the log ones
L->>FR: Restore the database on the new VM
L->>ALM: Configure the router with the new VPN tunnel
L->>L: Change erp.hortalia.internal to the new IP
L->>ALM: Key users validate the ERP
The slowest part is usually the VPN Gateway (around 30-45 minutes to create) and the database restore; with around 40 GB of data, the whole thing fits comfortably within the 8 hours.
11.3 Cost and drills
The cost of this strategy while there is no disaster is, essentially, that of storing the backups in the second region: with around 500 GB between full and log backups over 30 days at a cool access tier, of the order of tens of euros a month (an illustrative figure). A warm standby, with a second VM running 24/7, would multiply that cost by ten or more.
But a recovery plan that has never been tested is just a document. Laura schedules a half-yearly drill: recreate the environment in francecentral from the code, restore the latest backup, check that the ERP starts and that the data is recent, measure the real time taken, and destroy the environment afterwards. It complements the quarterly test restore of backups she already committed to in module 1.
Common Mistakes and Tips
- Lifting and shifting everything by default. First assess whether there is a SaaS or a PaaS that removes work. IaaS is the option when you need its control or cannot change the application.
- Leaving test environments running. Automate their schedule and use auto-shutdown as a safety net.
- Configuring auto-shutdown with the local time.
az vm auto-shutdownuses UTC. - Forgetting that disks are billed with the VM deallocated. The real saving is somewhat lower than the one on compute.
- Using production licenses for testing. SQL Server Developer is free for development and testing.
- Confusing high availability with disaster recovery. Zones protect you from the outage of one data center; disaster recovery, from the loss of a region or an attack that destroys the data.
- A recovery plan with no drills. On the day of the disaster you will discover that a network rule or a password is missing. Test it at least once a year, better twice.
- Tip: set the RPO and RTO with management, in business terms ("how many hours without invoicing can we take?"). They are business decisions, not technical ones, and they determine the cost.
Exercises
Exercise 1. For each situation, say whether IaaS is the best option and, if not, what alternative you would propose: a) a cooperative wants to render a 3D promotional video over a weekend; b) a startup is developing a Node.js API and has no systems administrators; c) a company needs to keep a 2012 application that only works on one specific version of Windows running for two years while it replaces it; d) an advisory firm wants its 10 employees to use a desktop application from home.
Exercise 2. Modify the crontab from case 2 so that the test VM is only switched on Monday to Thursday from 08:00 to 15:00 (nothing is tested on Friday). Recalculate the monthly saving with the same illustrative figures, assuming 17 Monday-to-Thursday working days in the month.
Exercise 3. After a scare, Hortalia's management asks for the ERP's RTO to be reduced to 1 hour. What disaster recovery strategy would you propose and what cost and operational implications would it have?
Solutions
Solution 1.
- a) IaaS yes, with spot GPU VMs (or a managed batch service that uses them): massive capacity for a few hours, with work that can be repeated if a VM is evicted.
- b) No: a PaaS (an application service or serverless containers) saves it from administering servers. We will see this in module 3.
- c) IaaS yes: it is the typical case of an OS requirement. Careful: if that version of Windows is out of support, it is wise to isolate it on the network and consider the extended security update options.
- d) It depends: a managed VDI (Azure Virtual Desktop) or Windows 365 if the application is a desktop one; but first it is worth checking whether a SaaS version of the application exists, which would remove the need for virtual desktops altogether.
Solution 2.
50 7 * * 1-4 /opt/hortalia/horario-pruebas.sh start >> /var/log/horario-pruebas.log 2>&1 0 15 * * 1-4 /opt/hortalia/horario-pruebas.sh deallocate >> /var/log/horario-pruebas.log 2>&1
The weekday field becomes 1-4 (Monday to Thursday) and the stop moves to 15:00. Hours: 7 h × 17 days ≈ 119 h. Compute: 119 × 0.20 = €23.80; plus €20 of disks = €43.80/month, against €166 running 24/7: a saving of around €122 a month (≈ 74%).
Common mistake: forgetting to change the start line as well, or writing 1-5 in one and 1-4 in the other: on Friday it would start and nobody would switch it off until auto-shutdown kicked in.
Solution 3. An RTO of 1 hour rules out backup and restore (creating the VPN Gateway already eats up a good part of that hour). Proposal: pilot light with Azure Site Recovery, which continuously replicates the disks of vm-erp-01 to francecentral, with the destination network and the VPN Gateway already created (the latter billed 24/7). In case of disaster, failover is triggered and the VM starts within minutes. Implications: a monthly cost for the VM's protection, the replicated storage, and the destination gateway (clearly higher than backups alone); the need for failover and failback drills; and checking with the ERP vendor and the licensing reseller whether the replicated VM requires extra licenses. Whether the business justifies that cost is management's decision.
Conclusion
You have seen the use cases where IaaS adds most value: the lift and shift of legacy applications, ephemeral test environments, disaster recovery, workloads with peaks, batches, and HPC, applications with OS or licensing requirements, virtual desktops, and analytics on VMs, each with its "when to" and "when not to" and with PaaS or SaaS alternatives to weigh up. For Hortalia, you have designed the phased migration of the ERP, a test environment that only consumes compute during office hours (with an illustrative saving of 61%), and a recovery plan in francecentral based on backups, with an RPO of 1 hour, an RTO of 8 hours, and half-yearly drills.
At several points in this lesson we have said "this gets recreated from code": the test environment, the disaster recovery infrastructure... So far we have typed commands one by one, which does not scale and leaves no reviewable trail. In the next lesson, Automating IaaS: Infrastructure as Code, we will learn to describe infrastructure in versioned text files and we will build Hortalia's ERP test environment with Terraform.
