[Editorial Notes: Guest article contributed by Praveen Kumar Muppala, Infrastructure Technical Lead at Kuliza.]
Amazon has recently launched a new feature called EC2 Instance Status Monitoring, which will monitor your instance and will let you know the status of your instance. Like it requires Instance reboot, System Reboot or Instance Retirement.
Before this feature, AWS EC2 machines will suddenly reboot, or will go to unresponsive state with out prior notice. This has caused the lot of troubles for the applications and data availability.
Today, there are three types of activities that we might need to undertake on our instances: System Reboot, Instance Reboot, or Instance Retirement. Amazon do all of these things today, but have only been able to tell us about the status via email notifications. Making the events available to you through our APIs and the AWS Management Console will allow you to review and respond to them either manually or programmatically.
Amazon will schedule a System Reboot when they need to do maintenance on the hardware or software supporting our instance. While Amazon are able to perform many upgrades and repairs to their fleet without scheduling reboots, certain operations can only be done by rebooting the hardware supporting an instance. Amazon won’t schedule System Reboots very often, and only when absolutely necessary. When an instance is scheduled for a System Reboot, we will be given a time window during which the reboot will occur. During that time window, we should expect our instance to be cleanly rebooted. This generally takes about 2-10 minutes but depends on the configuration of our instance. If our instance is scheduled for a System Reboot, it means our system will come up with a new underlying hardware.
If our instance’s root device is an EBS volume, we can stop and re-start it (be careful not to shutdown or terminate your instance). If we choose to do so, some configuration settings will changes.
If we stop and restart our instance, the following changes occur. If we wait for Amazon EC2 to perform the scheduled reboot automatically, these configuration settings remain the same, but there might be little impact on your services.
- Data in the Instance Store (e.g. data not stored on any attached EBS volume including the root device) will no longer be available. Before we stop the instance, backup any data you may need, and launch a new machine which will come up with new underlying hardware, and put the data and services back.
- The public DNS name and the private IP address of the instance will change.
- If you associated an Elastic IP address with this instance, stopping this instance also disassociates the Elastic IP address from it. Once you start the instance, re-associate it with the Elastic IP address if the address is still required.
- For instances in Amazon Virtual Private Cloud (Amazon VPC), the Elastic IP address and the private IP address remain unchanged.
Before you stop and restart an instance, perform the following tasks:
- Retrieve any data from the Instance Store (e.g., data that is not stored on any attached EBS volumes including the root device) that you will need later. Because there is no stop option for this, you need to terminate it and launch a new machine.
- Take a snapshot of your existing volume (storage charges will apply).
- Note the necessary configuration data in case you will need it later, including the DNS public name and the private IP address.
- Stop and restart your instance. For more information, see Stopping and Starting Instances
- Re-associate an Elastic IP address if this address is necessary.
- If other applications or instances rely on the public DNS name or the private IP address of this instance, update the information with the new configuration data.
An Instance Reboot is similar to a System Reboot except that a reboot of your instance is required rather than the underlying system. Because of this, we have the option of performing the reboot ourselves. We may choose to perform the reboot ourselves to have more control and better integrate the reboot into our operational practices. When an instance is scheduled for an Instance Reboot, we can choose to issue an EC2 reboot (via the AWS Management Console, the EC2 APIs or using other management tools) before the scheduled time and the Instance Reboot will be completed at that time. If you do not reboot the instance via an EC2 reboot, your instance will be automatically rebooted during the scheduled time.
The Best practice for this is: Instead of rebooting an instance through API’s or Amazon AWS console, login to the instance, and issue reboot command. That will have more control on the reboot.
Amzon will schedule an instance for retirement when it can no longer be maintained. This can happen when the underlying hardware has failed in a way that we cannot repair without damaging the instance. An instance that is scheduled for retirement will be terminated on or after the scheduled time. If you no longer need the instance, you can terminate it before its retirement date. If it is an EBS-backed instance, you can stop and restart the instance and it will be migrated to different hardware. You should stop/restart or replace any instance that is scheduled for retirement before the scheduled retirement date to avoid interruption to your application.
If instance’s root device is the Instance Storeand our instance is scheduled for retirement, we can opt to launch a replacement instance. After we have launched a replacement instance, we can terminate the original instance. If we choose to take this action, be aware that:
- The public DNS name and the private IP address of our replacement instance will differ from our original instance.
And we can perform the same steps for this Instance Retirement also like “System Reboot”.
API Calls Support
The new DescribeInstanceStatus function returns information about the scheduled events for some or all of our instances in a particular Region or Availability Zone. The following information is returned for each instance:
- Instance State – The intended state of the instance (pending, running, stopped, or terminated).
- Rebooting Status – An indication of whether or not the instance has been scheduled for reboot, including the scheduled date and time (if applicable).
- Retiring Status – An indication of whether or not the instance has been scheduled for retirement, including the scheduled date and time (if applicable).
Amazon will continue to send “degraded instance” notices to us via email to notify us of retiring instances.
AWS Console Support
We can view upcoming events that are scheduled for our instances in the EC2 tab of the AWS Management Console. The EC2 Console Dashboard contains summary information on scheduled events:
We can also click on the Scheduled Events link to view detailed information:
The instance list displays a new “event” icon next to any instance that has a scheduled event: