It sounds like your virtual machine (VM) is currently on a usage-based (pay-per-use) plan and may be auto-deallocating when idle or due to a budget constraint or incorrect setting.
Here's a guide to keep your VM running 24/7, retain its public IP and disk, and ensure you're billed monthly using your Azure credit (assuming you're using Azure; let me know if it's AWS/GCP instead):
- Prevent Auto-Deallocation
If the VM is getting auto-deallocated:
- Go to Azure Portal > Virtual Machines > Select your VM.
Check the Auto-shutdown setting (under "Operations").
Disable auto-shutdown if it's enabled.
Ensure you're not using Azure Dev/Test Labs, which can deallocate VMs based on schedules.
- Ensure Static Public IP
Dynamic IPs are released when VMs deallocate. To retain your public IP:
Go to Virtual Network Interface > IP Configurations.
Select the IP configuration and change assignment from "Dynamic" to "Static".
This keeps your IP even if the VM is stopped (as long as the NIC isn't deleted).
- Ensure Disk Retention
Disks are persistent by default in Azure, but double-check:
Under the VM settings, go to Disks.
Ensure the OS Disk and Data Disks are not temporary and are managed disks (they usually are by default).
If you're using a temporary disk (/dev/sdb1
on Linux or D:
on Windows), that data will be lost after a reboot — avoid storing anything critical there.
- Billing and Always-On Mode
To ensure you're billed monthly and the VM stays on:
Choose a Reserved Instance (RI) or Azure Savings Plan, which reduces costs if you're running 24/7.
Go to Cost Management + Billing > Reservations.
Reserve a VM of the same type/region to get lower prices (still billed monthly).
Ensure you’re not using a spot VM, which is cheaper but can be deallocated anytime.
Check this under your VM’s "Overview" or "Configuration".
- Link to Monthly Credit
If you have Azure credit (e.g., through Visual Studio subscription or MSDN), ensure it’s:
- Properly linked to your subscription.
- You're using the correct subscription for deploying your VM (check this in "Subscriptions").