---
title: 'How to Schedule EC2 Instances Automatically'
description: 'Compare three approaches to EC2 scheduling: AWS Instance Scheduler, Lambda + EventBridge, and managed tools. Step-by-step setup for each method.'
date: '2026-02-14'
readingTime: '6 min read'
---

## Why Schedule EC2 Instances?

There are 168 hours in a week. Most non-production EC2 instances — dev, staging, QA, demo environments — are actively used for maybe 40 to 50 of those hours. That means you are paying for over 120 hours of idle time every single week.

Scheduling instances to automatically stop outside business hours and restart when your team starts work saves **65% or more** on those resources. For a team running ten m5.xlarge instances in non-production, that is thousands of dollars per month — without changing a single thing about how you work.

## Option 1: AWS Instance Scheduler

AWS provides an official Instance Scheduler solution that you deploy via CloudFormation. It creates a stack of resources including Lambda functions, a DynamoDB table for schedule definitions, and EventBridge rules to trigger the scheduler.

### How it works

- Deploy the CloudFormation template in each account and region where you have resources
- Define schedules in the DynamoDB table (business hours, weekdays only, etc.)
- Tag your EC2 and RDS instances with the schedule name
- The Lambda function runs on a schedule and stops/starts tagged instances accordingly

### Pros

- Free — you only pay for the underlying infrastructure (Lambda invocations, DynamoDB reads)
- AWS-supported and well-documented
- Supports both EC2 and RDS

### Cons

- Complex initial setup with CloudFormation
- Must be deployed separately in each account and region
- Limited visibility — no dashboard or centralized view of schedules and savings
- Ongoing maintenance when AWS updates the solution or your needs change

## Option 2: Lambda + EventBridge (DIY)

If you want full control, you can build your own scheduling solution using Lambda functions triggered by EventBridge rules. Write a Lambda that calls the EC2 **StopInstances** and **StartInstances** APIs, then schedule it with EventBridge cron expressions.

### What you need to build

- IAM roles with permissions for EC2 and RDS stop/start operations
- Lambda functions with error handling, retries, and timeout configuration
- EventBridge rules with cron expressions for your schedule
- Logging and alerting so you know when something fails
- Multi-region and multi-account support if you need it
- A way to manage which instances are included (tags, resource groups, or configuration)

### Pros

- Full control over every aspect of the solution
- AWS-native, no external dependencies
- Can be customized to your exact requirements

### Cons

- Significant development effort to build properly
- Ongoing maintenance — Lambda runtimes deprecate, APIs change, edge cases surface
- Your team becomes responsible for reliability and monitoring
- Time spent building and maintaining this is time not spent on your product

## Option 3: Managed Scheduling Tools

SaaS solutions like [ParkMyAWS](https://parkmyaws.com) handle the entire scheduling problem as a managed service. You connect your AWS account via a read/write IAM role, select the resources you want to schedule, set your hours, and the service handles everything else.

### Pros

- Set up in 5 minutes — no CloudFormation, no Lambda functions, no EventBridge rules
- Zero maintenance — the service handles reliability, updates, and monitoring
- Dashboard showing all scheduled resources and estimated savings
- Alerts and notifications when actions succeed or fail
- Supports EC2 and RDS across multiple accounts and regions

### Cons

- Monthly subscription cost (though typically a fraction of the savings generated)
- Requires granting an IAM role to a third-party service

## Choosing the Right Approach

The best option depends on your team, your comfort level with AWS infrastructure, and how you want to spend your time.

- **Solo developer comfortable with CloudFormation** — The AWS Instance Scheduler gives you a proven solution without writing code from scratch
- **Team that wants full control and has DevOps capacity** — A DIY Lambda + EventBridge solution lets you build exactly what you need
- **Team that wants the fastest path to savings** — A managed tool like ParkMyAWS gets you up and running in minutes with no ongoing maintenance

There is no wrong answer here. All three approaches achieve the same result: your non-production instances stop running when nobody is using them.

## Getting Started

Pick one approach and start with your most expensive non-production resources. You do not need to schedule everything on day one — even scheduling a handful of large instances saves meaningful money immediately.

Identify your dev and staging environments, check their instance types and costs in Cost Explorer, and set up a schedule that matches your team's working hours. Most teams start with weekdays 8 AM to 6 PM in their local timezone and adjust from there.

The important thing is to start. Every hour your non-production instances run without anyone using them is money you could be saving.
