Amazon Elastic Compute Cloud
User Guide for Linux Instances

Scheduled Events for Your Instances

AWS can schedule events for your instances, such as a reboot, stop/start, or retirement. These events do not occur frequently. If one of your instances will be affected by a scheduled event, AWS sends an email to the email address that's associated with your AWS account prior to the scheduled event, with details about the event, including the start and end date. Depending on the event, you might be able to take action to control the timing of the event.

To update the contact information for your account so that you can be sure to be notified about scheduled events, go to the Account Settings page.

Types of Scheduled Events

Amazon EC2 supports the following types of scheduled events for your instances:

  • Instance stop: The instance will be stopped. When you start it again, it's migrated to a new host. Applies only to instances backed by Amazon EBS.

  • Instance retirement: The instance will be stopped if it is back by Amazon EBS or terminated if it is backed by instance store.

  • Instance reboot: The instance will be rebooted.

  • System reboot: The host for the instance will be rebooted.

  • System maintenance: The instance might be temporarily affected by network maintenance or power maintenance.

Viewing Scheduled Events

In addition to receiving notification of scheduled events in email, you can check for scheduled events using one of the following methods.

To view scheduled events for your instances using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events. Any resources with an associated event are displayed. You can filter by resource type, or by specific event types. You can select the resource to view details.

    
                            Viewing events using the Events page.
  3. Alternatively, in the navigation pane, choose EC2 Dashboard. Any resources with an associated event are displayed under Scheduled Events.

    
                            Viewing events using the dashboard.
  4. Note that some events are also shown for affected resources. For example, in the navigation pane, choose Instances and select an instance. If the instance has an associated instance stop or instance retirement event, it is displayed in the lower pane.

    
                            Viewing events in the instance details.

To view scheduled events for your instances using the AWS CLI

  • Use the following describe-instance-status command:

    aws ec2 describe-instance-status --instance-id i-1234567890abcdef0 --query "InstanceStatuses[].Events"

    The following example output shows an instance retirement event:

    [ "Events": [ { "Code": "instance-stop", "Description": "The instance is running on degraded hardware", "NotBefore": "2015-05-23T00:00:00.000Z" } ] ]

To view scheduled events for your instances using the AWS Tools for Windows PowerShell

  • Use the following Get-EC2InstanceStatus command:

    PS C:\> (Get-EC2InstanceStatus -InstanceId i-1234567890abcdef0).Events

    The following example output shows an instance retirement event:

    Code : instance-stop Description : The instance is running on degraded hardware NotBefore : 5/23/2015 12:00:00 AM

To view scheduled events for your instances using instance metadata

  • You can retrieve information about active maintenance events for your instances from the instance metadata as follows:

    [ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/events/maintenance/scheduled

    The following is example output with information about a scheduled system reboot event, in JSON format.

    [ { "NotBefore" : "21 Jan 2019 09:00:43 GMT", "Code" : "system-reboot", "Description" : "scheduled reboot", "EventId" : "243450899", "NotAfter" : "21 Jan 2019 09:17:23 GMT", "State" : "active" } ]

To view event history about completed or canceled events for your instances using instance metadata

  • You can retrieve information about completed or canceled events for your instances from the instance metadata as follows:

    [ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/events/maintenance/history

    The following is example output with information about a system reboot event that was canceled and a system reboot event that was completed, in JSON format.

    [ { "NotBefore" : "21 Jan 2019 09:00:43 GMT", "Code" : "system-reboot", "Description" : "[Canceled] scheduled reboot", "EventId" : "243450899", "NotAfter" : "21 Jan 2019 09:17:23 GMT", "State" : "canceled" }, { "NotBefore" : "29 Jan 2019 09:00:43 GMT", "Code" : "system-reboot", "Description" : "[Completed] scheduled reboot", "EventId" : "243451013", "NotAfter" : "29 Jan 2019 09:17:23 GMT", "State" : "completed" } ]

Working with Instances Scheduled to Stop or Retire

When AWS detects irreparable failure of the underlying host for your instance, it schedules the instance to stop or terminate, depending on the type of root device for the instance. If the root device is an EBS volume, the instance is scheduled to stop. If the root device is an instance store volume, the instance is scheduled to terminate. For more information, see Instance Retirement.

Important

Any data stored on instance store volumes is lost when an instance is stopped or terminated. This includes instance store volumes that are attached to an instance that has an EBS volume as the root device. Be sure to save data from your instance store volumes that you will need later before the instance is stopped or terminated.

Actions for Instances Backed by Amazon EBS

You can wait for the instance to stop as scheduled. Alternatively, you can stop and start the instance yourself, which migrates it to a new host. For more information about stopping your instance, as well as information about the changes to your instance configuration when it's stopped, see Stop and Start Your Instance.

You can automate an immediate stop and start in response to a scheduled instance stop event. For more information, see Automating Actions for EC2 Instances in the AWS Health User Guide.

Actions for Instances Backed by Instance Store

We recommend that you launch a replacement instance from your most recent AMI and migrate all necessary data to the replacement instance before the instance is scheduled to terminate. Then, you can terminate the original instance, or wait for it to terminate as scheduled.

Working with Instances Scheduled for Reboot

When AWS needs to perform tasks such as installing updates or maintaining the underlying host, it can schedule an instance or the underlying host for the instance for a reboot. Regardless of any existing instances that are scheduled for reboot, a new instance launch does not require a reboot, as the updates are already applied on the underlying host.

You can determine whether the reboot event is an instance reboot or a system reboot.

To view the type of scheduled reboot event (console)

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events.

  3. Choose Instance resources from the filter list, and then select your instance.

  4. In the bottom pane, locate Event type. The value is either system-reboot or instance-reboot.

To view the type of scheduled reboot event (AWS CLI)

  • Use the following describe-instance-status command:

    aws ec2 describe-instance-status --instance-ids i-1234567890abcdef0

Actions for Instance Reboot

You can wait for the instance reboot to occur within its scheduled maintenance window. Alternatively, you can reboot your instance yourself at a time that is convenient for you. For more information, see Reboot Your Instance.

After you reboot your instance, the scheduled event for the instance reboot is canceled and the event's description is updated. The pending maintenance to the underlying host is completed, and you can begin using your instance again after it has fully booted.

Actions for System Reboot

It is not possible for you to reboot the system yourself. We recommend that you wait for the system reboot to occur during its scheduled maintenance window. A system reboot typically completes in a matter of minutes, the instance retains its IP address and DNS name, and any data on local instance store volumes is preserved. After the system reboot has occurred, the scheduled event for the instance is cleared, and you can verify that the software on your instance is operating as you expect.

Alternatively, if it is necessary to maintain the instance at a different time, you can stop and start an Amazon EBS-backed instance, which migrates it to a new host. However, the data on the local instance store volumes would not be preserved. You can also automate an immediate instance stop and start in response to a scheduled system reboot event. For more information, see Automating Actions for EC2 Instances in the AWS Health User Guide.

In the case of an instance store-backed instance, you can launch a replacement instance from your most recent AMI, migrate all necessary data to the replacement instance before the scheduled maintenance window, and then terminate the original instance.

Working with Instances Scheduled for Maintenance

When AWS needs to maintain the underlying host for an instance, it schedules the instance for maintenance. There are two types of maintenance events: network maintenance and power maintenance.

During network maintenance, scheduled instances lose network connectivity for a brief period of time. Normal network connectivity to your instance will be restored after maintenance is complete.

During power maintenance, scheduled instances are taken offline for a brief period, and then rebooted. When a reboot is performed, all of your instance's configuration settings are retained.

After your instance has rebooted (this normally takes a few minutes), verify that your application is working as expected. At this point, your instance should no longer have a scheduled event associated with it, or the description of the scheduled event begins with [Completed]. It sometimes takes up to 1 hour for this instance status to refresh. Completed maintenance events are displayed on the Amazon EC2 console dashboard for up to a week.

Actions for Instances Backed by Amazon EBS

You can wait for the maintenance to occur as scheduled. Alternatively, you can stop and start the instance, which migrates it to a new host. For more information about stopping your instance, as well as information about the changes to your instance configuration when it's stopped, see Stop and Start Your Instance.

You can automate an immediate stop and start in response to a scheduled maintenance event. For more information, see Automating Actions for EC2 Instances in the AWS Health User Guide.

Actions for Instances Backed by Instance Store

You can wait for the maintenance to occur as scheduled. Alternatively, if you want to maintain normal operation during a scheduled maintenance window, you can launch a replacement instance from your most recent AMI, migrate all necessary data to the replacement instance before the scheduled maintenance window, and then terminate the original instance.