Scheduled events for your instances - Amazon Elastic Compute Cloud

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. The email provides 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. AWS also sends an AWS Health event, which you can monitor and manage by using Amazon CloudWatch Events. For more information about monitoring AWS Health events with CloudWatch, see Monitoring AWS Health events with CloudWatch Events.

Scheduled events are managed by AWS; you cannot schedule events for your instances. You can view the events scheduled by AWS, customize scheduled event notifications to include or remove tags from the email notification, and perform actions when an instance is scheduled to reboot, retire, or stop.

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.

Note

When an instance is affected by a scheduled event, and it is part of an Auto Scaling group, Amazon EC2 Auto Scaling eventually replaces it as part of its health checks, with no further action necessary on your part. For more information about the health checks performed by Amazon EC2 Auto Scaling, see Health checks for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide.

Types of scheduled events

Amazon EC2 can create the following types of events for your instances, where the event occurs at a scheduled time:

  • Instance stop: At the scheduled time, the instance is stopped. When you start it again, it's migrated to a new host. Applies only to instances backed by Amazon EBS.

  • Instance retirement: At the scheduled time, the instance is stopped if it is backed by Amazon EBS, or terminated if it is backed by instance store.

  • Instance reboot: At the scheduled time, the instance is rebooted.

  • System reboot: At the scheduled time, the host for the instance is rebooted.

  • System maintenance: At the scheduled time, the instance might be temporarily affected by network maintenance or power maintenance.

View scheduled events

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

Console
To view scheduled events for your instances
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. The dashboard displays any resources with an associated event under Scheduled events.

    
                                        Viewing events using the dashboard.
  3. For more detail, choose Events in the navigation pane. Any resources with an associated event are displayed. You can filter by characteristics such as event type, resource type, and Availability Zone.

    
                                        Viewing events using the Events
                                            page.
AWS CLI
To view scheduled events for your instances

Use the describe-instance-status command.

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

The following example output shows a reboot event.

[ "Events": [ { "InstanceEventId": "instance-event-0d59937288b749b32", "Code": "system-reboot", "Description": "The instance is scheduled for a reboot", "NotAfter": "2019-03-15T22:00:00.000Z", "NotBefore": "2019-03-14T20:00:00.000Z", "NotBeforeDeadline": "2019-04-05T11:00:00.000Z" } ] ]

The following example output shows an instance retirement event.

[ "Events": [ { "InstanceEventId": "instance-event-0e439355b779n26", "Code": "instance-stop", "Description": "The instance is running on degraded hardware", "NotBefore": "2015-05-23T00:00:00.000Z" } ] ]
PowerShell
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
Instance metadata
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 by using Instance Metadata Service Version 2 or Instance Metadata Service Version 1.

IMDSv2

[ec2-user ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/events/maintenance/scheduled

IMDSv1

[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" : "instance-event-0d59937288b749b32", "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 instance metadata by using Instance Metadata Service Version 2 or Instance Metadata Service Version 1.

IMDSv2

[ec2-user ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/events/maintenance/history

IMDSv1

[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" : "instance-event-0d59937288b749b32", "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" : "instance-event-0d59937288b749b32", "NotAfter" : "29 Jan 2019 09:17:23 GMT", "State" : "completed" } ]
AWS Health

You can use the AWS Health Dashboard to learn about events that can affect your instance. The AWS Health Dashboard organizes issues in three groups: open issues, scheduled changes, and other notifications. The scheduled changes group contains items that are ongoing or upcoming.

For more information, see Getting started with the AWS Health Dashboard in the AWS Health User Guide.

Customize scheduled event notifications

You can customize scheduled event notifications to include tags in the email notification. This makes it easier to identify the affected resource (instances or Dedicated Hosts) and to prioritize actions for the upcoming event.

When you customize event notifications to include tags, you can choose to include:

  • All of the tags that are associated with the affected resource

  • Only specific tags that are associated with the affected resource

For example, suppose that you assign application, costcenter, project, and owner tags to all of your instances. You can choose to include all of the tags in event notifications. Alternatively, if you'd like to see only the owner and project tags in event notifications, then you can choose to include only those tags.

After you select the tags to include, the event notifications will include the resource ID (instance ID or Dedicated Host ID) and the tag key and value pairs that are associated with the affected resource.

Include tags in event notifications

The tags that you choose to include apply to all resources (instances and Dedicated Hosts) in the selected Region. To customize event notifications in other Regions, first select the required Region and then perform the following steps.

You can include tags in event notifications by using one of the following methods.

Console
To include tags in event notifications
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events.

  3. Choose Actions, Manage event notifications.

  4. Turn on Include tags in event notifications.

  5. Do one of the following, depending on the tags that you want to include in event notifications:

    • To include all tags associated with the affected instance or Dedicated Host, select Include all tags.

    • To select the tags to include, select Choose the tags to include and then select or enter the tag keys.

  6. Choose Save.

AWS CLI
To include all tags in event notifications

Use the register-instance-event-notification-attributes AWS CLI command and set the IncludeAllTagsOfInstance parameter to true.

aws ec2 register-instance-event-notification-attributes \ --instance-tag-attribute "IncludeAllTagsOfInstance=true"
To include specific tags in event notifications

Use the register-instance-event-notification-attributes AWS CLI command and specify the tags to include by using the InstanceTagKeys parameter.

aws ec2 register-instance-event-notification-attributes \ --instance-tag-attribute 'InstanceTagKeys=["tag_key_1", "tag_key_2", "tag_key_3"]'

Remove tags from event notifications

You can remove tags from event notifications by using one of the following methods.

Console
To remove tags from event notifications
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events.

  3. Choose Actions, Manage event notifications.

  4. To remove all tags from event notifications, turn off Include tags in event notifications.

  5. To remove specific tags from event notifications, choose the X) for the corresponding tag keys.

  6. Choose Save.

AWS CLI
To remove all tags from event notifications

Use the deregister-instance-event-notification-attributes AWS CLI command and set the IncludeAllTagsOfInstance parameter to false.

aws ec2 deregister-instance-event-notification-attributes \ --instance-tag-attribute "IncludeAllTagsOfInstance=false"
To remove specific tags from event notifications

Use the deregister-instance-event-notification-attributes AWS CLI command and specify the tags to remove by using the InstanceTagKeys parameter.

aws ec2 deregister-instance-event-notification-attributes \ --instance-tag-attribute 'InstanceTagKeys=["tag_key_1", "tag_key_2", "tag_key_3"]'

View the tags to be included in event notifications

You can view the tags that are to be included in event notifications by using one of the following methods.

Console
To view the tags that are to be included in event notifications
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events.

  3. Choose Actions, Manage event notifications.

AWS CLI
To view the tags that are to be included in event notifications

Use the describe-instance-event-notification-attributes AWS CLI command.

aws ec2 describe-instance-event-notification-attributes

Work 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, hibernated, 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 might need later before the instance is stopped, hibernated, 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, in addition to 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 Amazon 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.

Work with instances scheduled for reboot

When AWS must perform tasks such as installing updates or maintaining the underlying host, it can schedule the instance or the underlying host for a reboot. You can reschedule most reboot events so that your instance is rebooted at a specific date and time that suits you.

View the reboot event type

You can view whether a reboot event is an instance reboot or a system reboot by using one of the following methods.

Console
To view the type of scheduled reboot event
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events.

  3. Choose Resource type: instance from the filter list.

  4. For each instance, view the value in the Event type column. The value is either system-reboot or instance-reboot.

AWS CLI
To view the type of scheduled reboot event

Use the describe-instance-status command.

aws ec2 describe-instance-status \ --instance-id i-1234567890abcdef0

For scheduled reboot events, the value for Code is either system-reboot or instance-reboot. The following example output shows a system-reboot event.

[ "Events": [ { "InstanceEventId": "instance-event-0d59937288b749b32", "Code": "system-reboot", "Description": "The instance is scheduled for a reboot", "NotAfter": "2019-03-14T22:00:00.000Z", "NotBefore": "2019-03-14T20:00:00.000Z", "NotBeforeDeadline": "2019-04-05T11:00:00.000Z" } ] ]
Actions for instance reboot

You can wait for the instance reboot to occur within its scheduled maintenance window, reschedule the instance reboot to a date and time that suits you, or reboot the instance yourself at a time that is convenient for you.

After your instance is rebooted, the scheduled event is cleared 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. You can wait for the system reboot to occur during its scheduled maintenance window, or you can reschedule the system reboot to a date and time that suits you. A system reboot typically completes in a matter of minutes. After the system reboot has occurred, the instance retains its IP address and DNS name, and any data on local instance store volumes is preserved. After the system reboot is complete, the scheduled event for the instance is cleared, and you can verify that the software on your instance is operating as expected.

Alternatively, if it is necessary to maintain the instance at a different time and you can't reschedule the system reboot, then 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 is not 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. For an instance store-backed instance, if you can't reschedule the system reboot, then 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.

Work with instances scheduled for maintenance

When AWS must 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 is 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 if it does, the description of the scheduled event begins with [Completed]. It sometimes takes up to 1 hour for the instance status description 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, in addition to 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.

Reschedule a scheduled event

You can reschedule an event so that it occurs at a specific date and time that suits you. Only events that have a deadline date can be rescheduled. There are other limitations for rescheduling an event.

You can reschedule an event by using one of the following methods.

Console
To reschedule an event
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Events.

  3. Choose Resource type: instance from the filter list.

  4. Select one or more instances, and then choose Actions, Schedule event.

    Only events that have an event deadline date, indicated by a value for Deadline, can be rescheduled. If one of the selected events does not have a deadline date, Actions, Schedule event is disabled.

  5. For New start time, enter a new date and time for the event. The new date and time must occur before the Event deadline.

  6. Choose Save.

    It might take a minute or two for the updated event start time to be reflected in the console.

AWS CLI
To reschedule an event
  1. Only events that have an event deadline date, indicated by a value for NotBeforeDeadline, can be rescheduled. Use the describe-instance-status command to view the NotBeforeDeadline parameter value.

    aws ec2 describe-instance-status \ --instance-id i-1234567890abcdef0

    The following example output shows a system-reboot event that can be rescheduled because NotBeforeDeadline contains a value.

    [ "Events": [ { "InstanceEventId": "instance-event-0d59937288b749b32", "Code": "system-reboot", "Description": "The instance is scheduled for a reboot", "NotAfter": "2019-03-14T22:00:00.000Z", "NotBefore": "2019-03-14T20:00:00.000Z", "NotBeforeDeadline": "2019-04-05T11:00:00.000Z" } ] ]
  2. To reschedule the event, use the modify-instance-event-start-time command. Specify the new event start time by using the not-before parameter. The new event start time must fall before the NotBeforeDeadline.

    aws ec2 modify-instance-event-start-time \ --instance-id i-1234567890abcdef0 \ --instance-event-id instance-event-0d59937288b749b32 \ --not-before 2019-03-25T10:00:00.000

    It might take a minute or two before the describe-instance-status command returns the updated not-before parameter value.

Limitations

  • Only events with an event deadline date can be rescheduled. The event can be rescheduled up to the event deadline date. The Deadline column in the console and the NotBeforeDeadline field in the AWS CLI indicate if the event has a deadline date.

  • Only events that have not yet started can be rescheduled. The Start time column in the console and the NotBefore field in the AWS CLI indicate the event start time. Events that are scheduled to start in the next 5 minutes cannot be rescheduled.

  • The new event start time must be at least 60 minutes from the current time.

  • If you reschedule multiple events using the console, the event deadline date is determined by the event with the earliest event deadline date.