Architecture overview - Instance Scheduler on AWS

Architecture overview

This section provides a reference implementation architecture diagram for the components deployed with this solution.

Architecture diagram

Deploying this solution deploys the following components in your AWS account.

      Instance Scheduler on the AWS Cloud

Instance Scheduler on the AWS Cloud

Instance Scheduler on AWS deploys an Amazon EventBridge event bus when the customer selects the CloudFormation parameter “Use AWS Organizations”. Optionally, Instance Scheduler on AWS deploys Amazon EventBridge diagram only shows the event bus, which is deployed in addition to the resources shown.

The high-level process flow for the solution components deployed with the AWS CloudFormation template is as follows:

  1. The AWS CloudFormation template sets up an Amazon CloudWatch event at a customer-defined interval. This event invokes the Instance Scheduler AWS Lambdafunction. During configuration, the user defines the AWS Regions and accounts, as well as a custom tag that Instance Scheduler on AWS uses to associate schedules with applicable Amazon EC2, Amazon RDS instances, and clusters.

  2. These values are stored in Amazon DynamoDB, and the Lambda function retrieves them each time it runs. You can then apply the custom tag to applicable instances.

  3. During initial configuration of the Instance Scheduler, you define a tag key you will use to identify applicable Amazon EC2 and Amazon RDS instances. When you create a schedule, the name you specify is used as the tag value that identifies the schedule you want to apply to the tagged resource.

    For example, a user might use the solution’s default tag name (tag key) Schedule and create a schedule called uk-office-hours. To identify an instance that will use the uk-office-hours schedule, the user adds the Schedule tag key with a value of uk-office-hours.

  4. Optional: When you select the CloudFormation parameter Using AWS Organizations as Yes and provide a valid organization id, an additional resource Event Bus resource is created which will receive events from the CloudWatch events from remote accounts. The events from the remote account will provide account id which will added to the solution configuration in DynamoDB.


AWS CloudFormation resources are created from AWS Cloud Development Kit (AWS CDK) constructs.

The Lambda function uses AWS Identity Access Management (AWS IAM) for permission requirements for your resources, and AWS Key Management System (AWS KMS) for encryption of the Amazon Simple Notification Service (Amazon SNS topic) and Dynamo DB tables.

Each time the solution’s Lambda function runs, it checks the current state of each appropriately tagged instance against the targeted state (defined by one or more periods in a schedule in the instance tag) in the associated schedule, and then applies the appropriate start or stop action, as necessary.

For example, if the Lambda function is invoked on a Friday at 9 AM (ET) and it identifies a stopped Amazon EC2 or Amazon RDS instance with a Schedule=office-hours tag, it will check Amazon DynamoDB for the office-hours schedule configuration details. If the office-hours schedule contains a period rule that indicates that the instance should run Monday through Friday from 9 AM ET to 5 PM ET, the Lambda function will start that instance.

The Lambda function also records the name of the schedule, the number of instances associated with that schedule, and the number of running instances as an optional custom metric in Amazon CloudWatch (refer to Amazon CloudWatch Metrics).


Stopping an Amazon EC2 instance is different from terminating an Amazon EC2 instance. By default, Amazon EC2 instances are configured to stop, not terminate, when shut down, but you can modify this behavior. Before using this solution, verify that instances are set to stop or terminate as appropriate.