question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stop only schedule (with manual start) not working

See original GitHub issue

Hi, I’m trying to implement a “stop only” schedule for my instances. The goal is to stop all instances at 10pm every day and leave them in stopped state until someone starts them manually (and stop them again automatically at 10pm). I naively created a single period and schedule for that:

scheduler-cli create-period --stack scheduler-stack --name stop-22 --endtime 22:00
scheduler-cli create-schedule --stack scheduler-stack --name stop-22  --periods stop-22

The first time the scheduler runs, it stops the instances at 22h00 as expected. So far, so good. The problem is: if I restart the instance manually, it never gets stopped again by the scheduler. After investigation, this is because the scheduler saves the “stopped” state in DynamoDB state table.

Thus, if I start the instance and remove the key in DynamoDB, then the scheduler stops the instance. But I don’t want to have to explicitely remove the DynamoDB key each time I restart my instance…

Thus the question is: can the current implemention of the scheduler allow doing this: stop only and without touching the DynamoDB ?

I guess that if I ask the scheduler to start the instance just before stopping it, this will work but ideally I would want to avoid to start the instances just for the stop to be working.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:13

github_iconTop GitHub Comments

2reactions
ozeebeecommented, Sep 16, 2019

Unlike #77, I don’t want to use the override-status. This would stop all tagged instances at next interval check. I just want (if possible) to have a schedule that makes sure tagged instances are stopped at a given time. The override-status cannot help for that.

1reaction
salyarkacommented, Sep 9, 2022

@madhavvishnubhatta i faced the same problem, schedule with option enforced solves it, you can update this option with true value manually in DynamoDB item, or create schedule with this option like this scheduler-cli create-schedule --stack InstanceScheduler --name QuickSchedule --periods QuickPeriod --enforced you can read about this option in docs in section Schedule definitions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop only schedule (with manual start) not working · Issue #122
Hi, one workaround for this is to use two periods. One period only has a begintime, and will start all stopped instances according...
Read more >
How do I use Instance Scheduler with CloudFormation to ...
Use predefined schedules · Open the Amazon EC2 console. · Choose the stopped instances that you want to tag. · Choose the Tags...
Read more >
Issue with AWS Instance Scheduler Schedule - Stack Overflow
Based on AWS documentation: The begintime and endtime fields define when the Instance Scheduler will start and stop instances.
Read more >
AWS Instance Scheduler: Everything you Need to Know
Important: Stop the EC2 instance that you're testing so that you can test a predefined running schedule. 1. Open the Amazon EC2 console....
Read more >
How to start and stop AWS EC2 instance based on a time ...
If you want to have specific instance started and stopped on a ... I haven't spent the time to work out how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found