Skip to content

Cost Optimisation for Managed VMs

A VM costs money for every hour it is allocated, whether it is used or not. Three levers keep the bill down: the right size, switching off what is not used, and committing to what always runs.

flowchart TD
    A["Start: optimise VM costs"] --> Z{"Is the VM sized correctly (CPU, memory)?"}
    Z -->|No| Y["Change the VM to the right size"]
    Y --> B
    Z -->|Yes| B{"Must the VM run 24/7?"}
    B -->|No| G["Enable an auto-shutdown schedule: stop outside usage hours"]
    B -->|Yes| C{"Is the load stable and predictable for 1+ year?"}
    C -->|Yes| D["Buy a reservation: 1 or 3 years"]
    C -->|No| E["Monitor usage for a month and decide again"]
    E --> B

A common rule on a platform (check yours): a VM either has an auto-shutdown schedule or is reserved.

VM type Typical rule
Non-production Shut down outside business hours (for example 19:00 to 07:00). Exceptions only for VMs that need to run 24/7.
Production Reserve the VM for 1 or 3 years once its usage is stable. Do not right-size and reserve on day one.

Stopping VMs every night can save up to about half of the compute cost. A one-year reservation is cheaper than pay-as-you-go by a double-digit percentage; the exact discount depends on the size, region and term. See Cost and reservations for how to buy one.

Auto-shutdown

An automation on the platform starts and stops VMs from a tag. You do not need a request. Whether it is available is platform-specific, so ask your platform team. Where it exists:

Add the tag AutoShutdownSchedule to the VM. All times are interpreted in one fixed time zone (Central European Time in the example platform; ask which one applies).

Value Effect
Time range, for example 19:00 -> 06:00 or 7PM -> 6AM The VM is stopped during the range and started outside it
Weekday, for example Saturday The VM is stopped the whole day
Date, for example December 25 The VM is stopped the whole day
Combination, separated by commas: 19:00 -> 06:00, Saturday, Sunday Stopped from 19:00 to 06:00 on weekdays and all day on weekends
AllDays The VM is deallocated indefinitely and is not started automatically

To keep a VM running once, even though a schedule exists (for example during maintenance or a test), add a tag PreventAutoShutdown. The value does not matter. Use true for clarity. Remove the tag when you are done. The automation skips the shutdown while the tag is there.

Patching and the schedule work together: a VM that is stopped by its schedule is started for its maintenance window, and stopped again afterwards. See Updates and patching.

The module also has an auto-shutdown hours field in the VM configuration (Request and change). Ask your platform team how it relates to the tag.

Disk cost review

Disks can cost more than the VM. Premium and zone-redundant disks, oversized data disks and unused disks add up. Review the disks of a VM configuration before you request it and after big changes.

Some platforms provide an assistant for this review, for example a custom agent for an AI coding assistant that works on the configuration file in the repository. If your platform has one, a review typically runs like this:

  1. Open the repository with the VM configuration file in your editor and start the agent in its agent mode.
  2. Give it the configuration file of one environment (run production and non-production separately; the rules differ).
  3. Answer its questions about the workload: what runs on the VMs, performance needs (IOPS, throughput, latency), what is on each data disk, peak usage and growth. Vague answers give cautious advice.
  4. The agent proposes changes one at a time: title with estimated monthly saving, the line to change, current configuration, problem, recommendation, trade-offs and impact. You answer yes (the agent edits the file), no (it is deferred) or tell me more.
  5. The review is saved as a document next to your configuration (one file per configuration file). It holds the workload context, a cost summary, the recommendations with their status (pending, accepted, deferred) and the estimated saving. Commit it with your change. It is the record of why a disk was downgraded, and a later review starts from it.

Re-run the review after you add disks or resize VMs. Treat the output as advice: you still decide.

Pilot tooling

An AI assistant needs an account and a licence of your own organisation, and the repository access to match. The platform team may still be evaluating whether it is worth keeping. Give feedback on the questions it asks and on the quality of the advice.