VM lifecycle across providers
From launch request to working application
A VM lifecycle starts with a management request that identifies the image, size, disks, network, identity and configuration. Accepted does not mean ready. After the provider allocates the VM, the guest boots, initializes its configuration, starts services and passes application checks. A VM can report running while its web server is still starting or misconfigured. Inspect application health independently from provider state. A failed launch or resize may reflect quota, policy, unsupported image, unavailable capacity or a guest startup failure.
An offline launch specification
This is a neutral design record, not an AWS, Azure or Google Cloud API payload. The names and size are fictional. No commands are executed.
{ "name": "bookstore-api-lab", "scope": "fictional-sandbox", "image": "reviewed-linux-x86-64-candidate", "size": { "vcpu": 4, "memoryGiB": 8 }, "bootDiskGiB": 30, "dataDiskGiB": 50, "publicManagement": false, "workloadIdentity": "read-book-catalog-only", "maxLifetimeHours": 4}Before a real launch, verify image publisher, patch level, license, CPU architecture, regional availability, quotas and actual rates. A lifetime field in this plan is an operator requirement, not an enforced provider timeout. Use explicit ownership, a separately authorized sandbox and bounded cleanup. Never submit the record as a real launch command.
Bootstrap and management without exposing secrets
Bootstrapping means configuring the guest during or after boot, for example installing a reviewed application artifact and starting its service. EC2 user data, Azure custom data or VM extensions, and Google Cloud startup scripts are distinct mechanisms whose timing and prerequisites differ. A script should be repeatable and report failures, because boot actions may be retried or run on later boots depending on configuration. Google Cloud startup scripts stored in metadata rely on the guest environment.
Instance metadata is information exposed to the guest about its environment; some metadata services can also issue workload credentials. Keep secrets out of images, user data, startup scripts, logs and metadata fields. Use scoped AWS instance-role credentials, Azure managed identity or a Google Cloud service account where appropriate. Apply provider-specific metadata protections. Management access is separate from application access: use an authorized private connection or managed session mechanism where supported, with identity and audit controls. Do not expose SSH or RDP to the public internet as a convenience. Network identity, IP addresses and guest identity may change across recreation.
Stop, restart, deallocate and delete are different
AWS: an ordinary stopped EBS-backed EC2 instance no longer incurs instance usage charges, but EBS volumes and other retained resources can cost money. A reboot is not the same as a stop. Termination is destructive for the instance, and disks configured for deletion are removed. Azure: Stopped (allocated) can still incur compute charges; Stopped (deallocated) releases the underlying allocation and stops VM compute usage charges, while managed disks and some other resources can remain billable. Google Cloud: a stopped Compute Engine VM is shown as TERMINATED and can generally be started again; that state is not the same as deleting the VM. Persistent disks and other retained charged resources can remain billable. Suspension is a separate operation with state-preservation storage costs and restrictions.
These descriptions concern ordinary VM usage, not every billing plan, transition state, attached product, commitment or license. Verify the final provider state and billing dimensions. Do not assume a stopped guest OS means compute allocation has ended. Recheck disk deletion flags, temporary storage semantics, public IP retention, snapshots and backups before any destructive action.
Calculate what remains after stopping
Use a fictional 30-day billing period and hypothetical rates: compute $0.12 per allocated hour, durable disks $0.10 per GiB-month, fixed retained monitoring $2 per month. A 30 GiB boot disk plus 50 GiB data disk costs $8 per month. Running for 100 billed hours costs $12; total for this model is $22. If the VM stays stopped but allocated for the remaining 620 hours, compute becomes 720 × $0.12 = $86.40 and the modeled total is $96.40. If it is deallocated after 100 hours, the modeled total remains $22, assuming the disks and monitoring remain for the full month.
The values are not real prices. The model omits taxes, licenses, transfer, snapshots, IP addresses, discounts, commitments and minimum billing periods. For a real comparison, obtain dated rates for the actual region, OS image, license and resource type. A paid commitment may continue even when a particular instance is stopped.
A safe cleanup and recovery checklist
First identify every lab-owned resource and its owner, dependencies and retention policy. Record disk delete-on-termination settings and verify recovery from an approved backup if data is needed. Stop application traffic and use the authorized lifecycle operation; verify the resulting management state and application status. Remove only explicitly approved lab resources that no longer serve a retention or dependency need. Review durable disks, temporary disks, IP addresses, snapshots, load balancers, logging and any automation that might recreate instances. Do not delete a shared network, identity or backup just because it appears in the inventory.
Finally reconcile the remaining resource inventory against expected retention and revisit billing after the provider reporting delay. A budget notification cannot guarantee a cap. No live cleanup occurs here. The offline fixture models only resource ownership, usage and approval, not real provider behavior.
Troubleshoot before changing the VM
If a VM is running but requests fail, inspect boot completion, application logs, listening address, network policy, identity permissions and health check configuration. If performance is poor, compare measured CPU saturation, credit balance where applicable, RAM and disk I/O. If a VM will not start, inspect quota, image architecture, placement and allocation errors. Avoid resizing or rebooting blindly: collect evidence, plan rollback and protect durable state. The next chapter covers object storage and how its lifecycle differs from VM disks.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
VM lifecycle across providers — knowledge check
Choose the best answer for each offline scenario.
Which Azure VM state can still incur VM compute usage charges?
In Compute Engine, a stopped VM is shown as TERMINATED. What does this mean in the normal lifecycle?
With $0.12 per billed hour, 100 hours, $8 disks and $2 monitoring, what is the modeled total?
What is the best approach to workload credentials?
A lab-owned disk has a required recovery retention policy. What should cleanup do?