The EC2 Instance Life Cycle


The EC2 Instance Life Cycle

Working with virtual infrastructure is not a whole lot different than using real hardware, but it's easy to get confused when things are different. In this article I'll take a look at the life cycle of Amazon EC2 instances and how it differs from the traditional life cycle of real computers.

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:
  1. 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.
  2. 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:
  1. 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.
  2. 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?
If you can't restart a terminated instance and you can't access the data on a terminated instance, how do you accomplish in the EC2 cloud all the "usual" things that you do with real computers? Specifically:
  • 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?
And, what does an AMI have to do with the life cycle model? What about the life cycle model changes if you bundle your instance into an AMI? (Spoiler: nothing).

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. 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值