Amazon Web Services (AWS) offers infrastructure on demand so that customers can control their resource capacity and pay only for what they consume. One simple method to reduce costs is to stop resources that are not in use, and then start those resources again when their capacity is needed.

The AWS Instance Scheduler is a simple AWS-provided solution that enables customers to easily configure custom start and stop schedules for their Amazon Elastic Compute Cloud (Amazon EC2) and Amazon Relational Database Service (Amazon RDS) instances. The solution is easy to deploy and can help reduce operational costs for both development and production environments. Customers who use this solution to run instances during regular business hours can save up to 70% compared to running those instances 24 hours a day.

This webpage provides best practices for implementing automated actions on resources, as well as an overview of the Instance Scheduler design and functionality.

instance-scheduler-savings

When running infrastructure on the cloud, automate the monitoring and management of resources whenever possible and be sure to stop resources when they are not in use. Automated actions are more reliable than manual processes, helping to maximize savings and identify trends in overprovisioning. For optimal efficiency and cost savings, consider these best practices when implementing an automated start-stop solution:

  • Plan for exceptions and account for different schedules and usage scenarios. A one-size-fits-all approach is seldom realistic, even within the same department. Choose a flexible and customizable tool that can accommodate your needs.
  • Implement a resource-identification system, such as tags for instances. This helps to ensure that automated actions are targeted to the correct resource, and also allows for easier filtering, modification, and troubleshooting according to categories that you define.
  • Grant least-privilege access to individuals or systems that perform automated actions on resources.  

AWS offers a simple solution that allows you to create automatic start and stop schedules for your Amazon EC2 and Amazon RDS instances. The diagram below presents the components and functionality you can build using the Instance Scheduler implementation guide and accompanying AWS CloudFormation template.

instance-scheduler-architecture
  1. An Amazon CloudWatch event triggers an AWS Lambda function that checks the current state of each appropriately tagged instance against the targeted state defined in an associated schedule in Amazon DynamoDB.
  2. The Lambda function then applies the applicable start or stop action to the instance.
  3. 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.  
Deploy Solution
Implementation Guide

What you'll accomplish:

Deploy the AWS Instance Scheduler using AWS CloudFormation. The CloudFormation template will automatically launch and configure the components necessary to automatically start and stop Amazon EC2 and Amazon RDS instances in all AWS Regions of your account.

Configure multiple start and stop schedules by either deploying multiple Instance Schedulers or modifying individual resource tags. The Instance Scheduler solution gives you the flexibility to automatically manage multiple schedules as necessary.

Review Instance Scheduler metrics to better assess your Instance capacity and usage, and to calculate your cost savings.

What you'll need before starting:

An AWS account: You will need an AWS account to begin provisioning resources. Sign up for AWS.

Skill level: This solution is intended for IT infrastructure and DevOps professionals who have practical experience with automation and architecting on the AWS cloud.

Q: How do I schedule my instances?

First, you define schedules in the solution's configuration Amazon DynamoDB table. Then, you tag applicable Amazon EC2 and Amazon RDS instances with the name of the applicable schedule.

Q: What default start and stop times does the Instance Scheduler use?

You define a schedule that contains running periods that define the start and stop times for instances. If you specify a start time only, the instance must be stopped manually. Similarly, if you specify a stop time only, the instance must be started manually. You can also choose to run instances during specific days of the week, days of the month, or months of the year. For more information, see the implementation guide.

Q: Can I create multiple start-stop schedules for a single instance?

Yes. Each schedule can contain multiple periods. When more than one period is used in a schedule, the Instance Scheduler will apply the appropriate start action when at least one of the period rules is true. For more information, see the implementation guide.

Q: At what interval(s) can the Instance Scheduler start and stop my instances?

By default, the AWS Lambda function checks the state of each instance at five minute intervals which means the solution will perform start and stop actions every five minutes. You can change the default interval, but this might reduce the granularity of your schedules. For example, a Lambda function set to run at fifteen minute intervals will only perform start and stop actions every 15 minutes.

Q: Do I configure start and stop times in my local time zone?

During initial configuration, you specify a default time zone that is used for all instances you schedule with the solution. You can also define a time zone for an individual schedule that is used only for instances that use that schedule.

Need more resources to get started with AWS? Visit the Getting Started Resource Center to find tutorials, projects and videos to get started with AWS.

Tell us what you think