AWS EC2 Scheduled Events

step-by-step instructions for how to set up.

Amazon Elastic Compute Cloud
Amazon Elastic Compute Cloud (EC2) is a part of Amazon.com’s cloud-computing platform, Amazon Web Services (AWS), that allows users to rent virtual computers on which to run their own computer applications. EC2 promotes scalable application deployment by offering a web service that allows a customer to start an Amazon Computer Image (AMI) to set up a virtual machine, or “instance,” as Amazon refers to it, with any needed software. The phrase “elastic” refers to the ability of a user to construct, launch, and terminate server instances as needed while paying per second for active servers. By giving users control over the physical location of instances, EC2 enables users to reduce latency and increase redundancy. Amazon migrated to EC2 and AWS as their retail website platform in November 2010.

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. 

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.

Contents

  • Types of scheduled events
  • View scheduled events
  • Customize scheduled event notifications
  • Work with instances scheduled to stop or retire
  • Work with instances scheduled for reboot
  • Work with instances scheduled for maintenance
  • Reschedule a scheduled event
  • Define event windows for scheduled events

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.

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 applicationcostcenterproject, 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.

Topics

  • Include tags in event notifications
  • Remove tags from event notifications
  • View the tags to be included in event notifications

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.

Remove tags from event notifications

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

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.

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.

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. You can automate an immediate stop and start in response to a scheduled instance stop event. 

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.

If you stop your linked EC2-Classic instance, it is automatically unlinked from the VPC and the VPC security groups are no longer associated with the instance. You can link your instance to the VPC again after you’ve restarted it.

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.

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. You can automate an immediate stop and start in response to a scheduled maintenance event.

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.

Define event windows for scheduled events

You can define custom event windows that recur weekly for scheduled events that reboot, stop, or terminate your Amazon EC2 instances. You can associate one or more instances with an event window. If a scheduled event for those instances is planned, AWS will schedule the events within the associated event window.

You can use event windows to maximize workload availability by specifying event windows that occur during off-peak periods for your workload. You can also align the event windows with your internal maintenance schedules.

You define an event window by specifying a set of time ranges. The minimum time range is 2 hours. The combined time ranges must total at least 4 hours.

You can associate one or more instances with an event window by using either instance IDs or instance tags. You can also associate Dedicated Hosts with an event window by using the host ID.

Work with event windows

  • Considerations
  • View event windows
  • Create event windows
  • Modify event windows
  • Delete event windows
  • Tag event windows

Considerations

  • All event window times are in UTC.
  • The minimum weekly event window duration is 4 hours.
  • The time ranges within an event window must each be at least 2 hours.
  • Only one target type (instance ID, Dedicated Host ID, or instance tag) can be associated with an event window.
  • A target (instance ID, Dedicated Host ID, or instance tag) can only be associated with one event window.
  • A maximum of 100 instance IDs, or 50 Dedicated Host IDs, or 50 instance tags can be associated with an event window. The instance tags can be associated with any number of instances.
  • A maximum of 200 event windows can be created per AWS Region.
  • Multiple instances that are associated with event windows can potentially have scheduled events occur at the same time.
  • If AWS has already scheduled an event, modifying an event window won’t change the time of the scheduled event. If the event has a deadline date, you can reschedule the event.
  • You can stop and start an instance prior to the scheduled event, which migrates the instance to a new host, and the scheduled event will no longer take place.

View event windows

You can view event windows by using one of the following methods.

Create event windows

You can create one or more event windows. For each event window, you specify one or more blocks of time. For example, you can create an event window with blocks of time that occur every day at 4 AM for 2 hours. Or you can create an event window with blocks of time that occur on Sundays from 2 AM to 4 AM and on Wednesdays from 3 AM to 5 AM. Event windows recur weekly until you delete them.

Use one of the following methods to create an event window.

Modify event windows

You can modify all of the fields of an event window except its ID. For example, when daylight savings begin, you might want to modify the event window schedule. For existing event windows, you might want to add or remove targets.

Use one of the following methods to modify an event window.

Delete event windows

You can delete one event window at a time by using one of the following methods.

Tag event windows

You can tag an event window when you create it, or afterwards.

Use one of the following methods to tag an event window.