The Life Cycle of "Real" Computers
By "life cycle" I mean "the different stages that a computer goes through from power-on to power-off". This is best explained with a diagram:
Real
computers begin their service lives "off". Someone hits the power
button and the computers start booting up, eventually settling into a
"running" state. From there they can be rebooted, hibernated,
suspended, or shut-down normally. (Of course, something abnormal can
happen, such as a power failure, which would cause the machine to
immediately return to the "off" state. This is not represented in the
diagram above.)
The diagram highlights two important features of the life cycle of real computers:
- Real computers cost you money even when they are not in use. Of course they consume power when they are on, and you pay for that power. But even when they are off they cost money, if only for the space that they occupy. This is represented in the diagram by the green box: real computers cost you money no matter if they are in use or not.
- Even when they are "off", real computers remain yours. The information stored on their hard drives stays there, waiting to be accessed the next time the machine is powered on. This is represented by the arrows leading into and exiting the "off" state: even if you turn a computer off, you can still turn it on again.
The Life Cycle of EC2 Instances
The above two features of real computers, costing money and being yours to control, are different for virtual computers in the cloud. Different clouds have different features, but the Amazon EC2 instance life cycle looks like this:
EC2 instances begin their lives when you launch them (such as with the
ec2-run-instances
command). They spend some time in the "pending" state, waiting for the
reservation to be fulfilled. Once the instances have begun to boot they
are in the "running" state. Here they will stay until they are
terminated (such as with the ec2-terminate-instances
command), which causes the instances to begin "shutting down", ending with the instances being "terminated".The above diagram illustrates how EC2 instances are different than real computers as far as costing money and being yours to control is concerned:
- EC2
instances only cost money when they are "running". You do not pay for
instance-hours for pending, shutting down, or terminated instances.
This is represented in the diagram by the green box, which only
surrounds the "running" state. This is unlike real computers, which
cost money even when they are off.
- Once an EC2 instance is
no longer "running", you no longer control it. In the diagram, there is
no way to get an instance from "shutting down" back to "running". This means that you cannot get back an instance that was terminated
- the data stored on that computer's local disks ("ephemeral storage")
can not be retrieved. Real computers, on the other hand, are still
controlled by you when they are not running - all you need to do to
access their data is to power them on.
Follow-on Questions
If the data that you place on the "ephemeral storage" of an EC2 instance is no longer accessible once you terminate it, what happens to the data? Specifically:
- What processes does Amazon have in place to make sure that the ephemeral storage drives do not present a privacy risk, allowing other instances possibly belonging to other people to see the data left over on the ephemeral drives you have relinquished?
- What
can you do to mitigate the privacy risk of your leftover data on
ephemeral storage, without relying on Amazon to do it for you?
- How do you keep data and applications in EC2 without keeping an instance running?
- How do you make sure that your data and applications can be easily restored if your instance terminates unexpectedly?
These questions will be the subject of future articles, so stay tuned. Until then, remember that one of the major differences between real computers and EC2 instances is their life cycles: in EC2 you only pay for, and control, instances that are running.