Overview
Instance Scheduler on AWS automates the starting and stopping of various AWS services, including Amazon Elastic Compute Cloud (Amazon EC2), Amazon EC2 Auto Scaling Groups, and Amazon Relational Database Service (Amazon RDS) instances. Automating this process helps reduce operational costs by stopping and starting resources as needed. This AWS Solution uses resource tags and AWS Lambda to automatically stop and start instances based on a schedule you define, and it can be deployed across multiple AWS Regions.
When compared to a setup where you leave all your instances continuously running at full utilization (even when those resources aren't being used), this solution can lead to significant cost savings by aligning your workloads with the AWS Well-Architected Cost Optimization best practices.
Benefits
This solution includes a template that creates the AWS Identity and Access Management (IAM) roles necessary to start and stop instances in secondary accounts.
This solution can automatically add tags to all instances it starts or stops. The solution also includes macros that allow you to add variable information to the tags.
This solution includes a command line interface (CLI) that provides commands for configuring schedules and periods. The CLI allows customers to estimate cost savings for a given schedule.
For EC2 instances, this solution can use Systems Manager maintenance windows defined in the same AWS Region as the instances and start and stop the instances for the maintenance window.
Technical details
You can automatically deploy this architecture using the implementation guide and the accompanying AWS CloudFormation templates, or get started with the resources below:
Step 1
This AWS Solution deploys an Amazon EventBridge rule with a configurable scheduling interval. This scheduling interval defines how frequently the solution runs and takes action to schedule your instances.
Step 2
Each scheduling interval invokes an AWS Lambda orchestration function. This will determine the list of AWS accounts, regions, and services that need to be scheduled. The orchestrator will then invoke multiple scheduling request Lambda functions in parallel to perform scheduling activities.
Step 3
A collection of schedules and periods are stored in an Amazon DynamoDB configuration table to control the scheduling behavior of this solution. You can configure any number of schedules or periods in this table, and the solution will schedule instances accordingly.
Step 4
Each scheduling request inspects resources in its particular target (account, region, service) to find resources that have been tagged for scheduling by using schedules defined in the solution’s configuration table. The scheduling request handler then inspects the configured schedules and performs the required scheduling actions.
Step 5
If auto scaling group (ASG) scheduling is enabled, Instance Scheduler on AWS deploys an hourly EventBridge rule and associated resources to manage scheduled scaling actions for tagged Amazon EC2 Auto Scaling groups.
Step 6
In addition to the hourly scan, this solution also tracks updates to schedules in the configuration table. When a schedule is updated, a secondary orchestration Lambda function is invoked so that ASG scheduled scaling actions are kept up to date with the most recent schedule configuration.
Step 7
This solution provides multiple ways to create or update schedules in the solution’s configuration table, along with several example schedules to use as a starting point. Configuration methods include: the DynamoDB console, a scheduler command line interface (CLI), and an AWS CloudFormation Custom resource.
Step 8
If AWS Orgs Mode is enabled and a valid Organization ID is provided when the solution is deployed, Instance Scheduler on AWS automatically registers newly deployed spoke stacks with the solution hub stack. The hub and spoke stacks must be deployed in the same Region and in accounts that are members of the same AWS Organization.
Related content
With Quick Setup, a capability of AWS Systems Manager, you can configure Resource Scheduler to automate the starting and stopping of your EC2 instances across your AWS accounts and Regions. Resource Scheduler provides a simple user interface (UI).
To learn more about Resource Scheduler, review related resources in the implementation guide.
Build modern, scalable applications on AWS to transform your organization, all while optimizing costs through Cost Optimization with AWS. The variety of AWS pricing options provides you with the flexibility to design your purchase plan to meet your specific workload needs.
This repository contains documentation and code in the format of hands-on labs to help you learn, measure, and build cost optimized workloads using well-architected best practices.
You can learn more here.
This Guidance helps you set up a Cloud Financial Management (CFM) capability to manage and optimize your expenses for cloud services. This capability includes near real-time visibility and cost and usage analysis to support decision-making for topics such as spend dashboards, optimization, spend limits, chargeback, and anomaly detection and response.
- Publish Date