Automate Start-Stop EC2 Instances Using Lambda
Automate Start-Stop EC2 Instances Using Lambda
2. Name: StartEC2Instances
Name: StopEC2Instances
Name: Ashish Kumbhojkar
Name: Ashish Kumbhojkar
Name: Ashish Kumbhojkar
You’ll now set a cron schedule to trigger each function at a specific time.
For Start:
2. Name: StartEC2Schedule
For Stop:
You can adjust the time to your timezone. Note that AWS cron uses UTC.
• Check CloudWatch Logs to confirm that the correct instances were started/stopped.
• You can also verify by looking at EC2 state changes in the EC2 Dashboard.
Optional: Enhancements
• Environment Variables: Store instance IDs or tag keys as env vars in Lambda.
Name: Ashish Kumbhojkar
• Slack or Email Alerts: Add SNS notifications to get alerts when instances are
started/stopped.
By Following steps we will create a scheduled programming for EC2 to start and stop.
End Results
EC2 instances with the tag AutoStartStop = true will start at 9 AM UTC.
Everything runs serverless and hands-free via AWS Lambda and EventBridge.