www.awsgood.com
整理 EC2 Instance Lifecycle 和常遇到的 Troubleshooting.
下圖是 EC2 Instance State 的狀態流程圖,兩種 EBS-backed and Store-backed 的流程:
圖片來源:Instance Lifecycle
AMI 建立新的 EC2 Instance. 開始跑的狀態是 pending.stop, start 兩個動作, Instance 就會到另一台狀態正常的機器執行起來。running, 執行 stop, 狀態會: running -> stopping -> stopped. 停止之後的 Instance 將不再收費,但是 EBS 會收費。start Instance, 狀態會:pending -> runningDeleteOnTermination 屬性決定是否刪除,其他 Root 以外的 Volume 則需要手動刪除。開機狀態有兩個,分別是 System Status Checks, Instance Status Checks. 這兩個都正常,才算是開機成功。
通常是軟體或者是網路問題。
到 EC2 Console -> 選擇 Instance -> Status Checks 找到錯誤訊息:
如果遇到 Status Checks 的問題,可以透過 Create Status Check Alarm 處理,可以做以下動作:
重要的服務,建議開啟此功能。
t2 系列,確認 CPU Credit 是不是還足夠注意: 通常這不會跟 IAM Role, Policy 有關.
通常就是硬體維護、或者有問題,這時候 AWS Data Center 準備做維護。需要把在上面跑的 Instance 移轉到其他機器。通常管理者會收到類似以下的信:
Dear Amazon EC2 Customer,
One or more of your Amazon EC2 instances is scheduled for maintenance on 2016-03-29 for 2 hours starting at 12:00 UTC. During this time, the following instances in the ap-northeast-1 region will be unavailable and then rebooted:
i-b4e0xxxx
Your instances will return to normal operations after maintenance is complete and all of your configuration settings will be retained. To continue normal operation and avoid any unavailability or reboots during this time, you can migrate the instances listed above to replacement instances. Replacement instances will not be affected by this scheduled maintenance. Otherwise, no action is generally required on your part (certain underlying system components may change at reboot time, and your operating system may prompt you to install additional software/drivers post-reboot as a result). If your instance is part of an auto-scaling group, then it will automatically be terminated and replaced by a newly launched instance during the maintenance window.
You can see more information on this maintenance in the AWS Management Console at https://console.aws.amazon.com/ec2/home?region=ap-northeast-1#s=Events.
Additional information about maintenance events, including how to migrate to replacement instances, can be found at http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html.
We perform maintenance regularly to ensure that the EC2 service continues uninterrupted for our customers. In most cases, maintenance can be performed without service interruption. When maintenance cannot be performed without service interruption, we work hard to keep any impact as brief as possible.
If you have any questions or concerns, you can contact the AWS Support Team on the community forums and via AWS Premium Support at: http://aws.amazon.com/support.
Sincerely,
Amazon Web Services
收到這樣的信,到 EC2 Console -> Events 查看看是哪一台、Event Type 是啥。
大部份的 maintenance 都只要 stop, start 就可以排除狀況,通知信裡也會有詳細的說明。
參考資料:Scheduled Events for Your Instances
更多 Troubleshooting see: Troubleshooting Instances with Failed Status Checks
參考資料