E-learningLatestNew CoursesNews

AWS EC2 Instance Scheduler: Automate EC2 and RDS Instances

AWS EC2 Instance Scheduler: Automate EC2 and RDS Instances

DevOps Engineer
In addition, you can use to build your modern application in the AWS Cloud.

AWS EC2 and RDS Instance Scheduler

The AWS Instance Scheduler is a solution that enables customers to easily configure custom start and stop schedules for their Amazon EC2 and Amazon RDS instances. The solution is easy to deploy and can help reduce operational costs for both development and production environments

The Power of AWS EC2 and RDS Instance Scheduler

The solution deploys Amazon CloudWatchAWS Lambda, and Amazon DynamoDB. For pricing details, see the pricing webpage for each AWS service you will be using in this solution.

aws-instance-scheduler-architecture
AWS EC2 and RDS Instance Scheduler: Learn more at ClayDesk

This solution includes a template that creates the AWS Identity and Access Management (IAM) roles necessary to start and stop instances in secondary accounts.

Basically, the Instance Scheduler 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.

In addition, 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.

Above all, you can achieve partial automation very easily, and users have the option to implement a partially automated solution by default.

Most developers like the idea of automated code review and even small amounts of time saved or bugs averted are of considerable value. Therefore, modern editors like Eclipse Neon or Visual Studio Code already provide coding assistance with common errors, auto completion and auto formatting. Thus, if you try coding in Notepad without this kind of help you soon discover how useful it is.

AWS EC2 Instance Scheduler architecture

Basically, 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. Then, the Lambda function applies the applicable start or stop action to the 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.

Get Source Code Now!

Navigate to https://github.com/razaphd/aws-instance-scheduler and get the source code for this AWS Instance and RDS Scheduler.

You can also download the CloudFormation Template

Frequently Asked Questions

How do I schedule my instances?

First of all, 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

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.

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.

Moreover, learn more about our AWS Certification courses and DevOps Engineer E-Degree program