Instance lifecycle, metadata and cost
Instance states are not application health
A new instance moves from pending to running. Running indicates a compute lifecycle state, not that the application is ready. For an EBS-backed instance, stop shuts down compute while retaining attached EBS volumes; start boots it again. Reboot restarts the operating system without a stop/start cycle. Termination ends that instance permanently. A normal stop loses RAM contents and instance-store data; hibernation has different prerequisites and behavior. A stop/start may change an automatically assigned public IPv4 address, so do not design around its permanence.
Check the right layer
System status checks help detect underlying AWS infrastructure problems; instance checks help detect guest reachability problems; attached EBS checks can reveal storage connectivity or I/O impairment on supported instances. These are selected check categories, not an exhaustive list. A passing infrastructure check does not prove that a report job completed. Inspect application logs and a suitable application health signal before diagnosing success. Avoid destructive restart or termination before preserving needed evidence and data.
Protect instance metadata
The Instance Metadata Service (IMDS) makes instance information available to software inside EC2, including temporary role credentials when applicable. IMDSv2 uses a session token for metadata requests. Require IMDSv2 for compatible workloads; disable metadata access when it is not needed and the workload supports that choice. Treat metadata credentials as secrets: never log them or expose a metadata endpoint through an application. IMDSv2 is one layer, not a substitute for least privilege or application security. This lesson does not query metadata or real credentials.
Worked cost and cleanup example
Use invented rates in USD, not AWS quotes: compute $0.04/hour, storage $0.10/GiB-month. One worker runs for 10 hours and is stopped for the rest of the month; a 20 GiB volume exists for the whole month. Compute is $0.40 and storage $2.00, totaling $2.40 in this simplified model. A stopped On-Demand instance normally has no instance compute usage charge, but storage and other resources or commitments can still cost money. Real billing includes regional rates, billing units, storage type, snapshots, network traffic, public IPv4, logs, licenses, endpoints and discounts where applicable.
Safe end-of-lab checklist
For each lab-owned volume check DeleteOnTermination and whether any data must be preserved; terminating an instance can delete marked volumes and leave others billable. Verify backups and restore requirements before any deletion. Review lab-owned snapshots, allocated public addresses, endpoints, log retention and other resources separately; shared resources must not be deleted. Record inventory and check billing later because billing data can lag. Practice: if a data volume is retained after termination, is cleanup complete? No; decide whether to preserve or remove that specific volume after authorization. Next: learn EBS storage in detail.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Instance lifecycle, metadata and cost — knowledge check
Apply EC2 concepts in fictional offline scenarios.
An EBS-backed On-Demand instance is stopped. Which cost can continue?
A status check passes but the report is missing. What is the next useful check?
What does requiring IMDSv2 provide?
Using the lesson’s fictional rates, what is the cost of 10 hours and 20 GiB retained for one month?
A data volume survives instance termination. What should you do?