Comments (11)
For period 1 only specify the begin and no end time, that will work.
You can verify the scheduled periods using the scheduler-cli describe-schedule-usage command with the schedule and period you want to check. It tells you exactly in which periods your instance will be active.
from instance-scheduler-on-aws.
Fantastic. It's true, I didn't try this solution before. Thank you!
from instance-scheduler-on-aws.
Too fine to be true. It does not works.
SCHEDULE
descriptionString: Nightly-stop
nameString: nightly-stop
periodsStringSet[2]
0: backup-hours
1: backup-hours-2
timezoneString: Europe/Rome
typeString: schedule
use_metricsBoolean: true
PERIODS:
begintimeString: 19:00
descriptionString: Backup hours
nameString: backup-hours
typeString: period
use_metricsBoolean: true
weekdaysStringSet[1]
0: mon-sun
descriptionString: Backup hours 2
endtimeString: 10:00
nameString: backup-hours-2
typeString: period
use_metricsBoolean: true
weekdaysStringSet[1]
0: mon-sun
LOG
2018-03-09 - 11:00:16.434 - DEBUG : [ Instance EC2:i-xxxxxx (testserver) ]
2018-03-09 - 11:00:16.434 - DEBUG : Current state is running, instance type is c3.large, schedule is "nightly-stop"
2018-03-09 - 11:00:16.434 - DEBUG : Time used to determine desired for instance is Fri Mar 9 12:00:05 2018
2018-03-09 - 11:00:16.434 - DEBUG : Checking conditions for period "backup-hours-2"
2018-03-09 - 11:00:16.434 - DEBUG : [running] Weekday "fri" in weekdays (mon-sun)
2018-03-09 - 11:00:16.434 - DEBUG : [stopped] Time 12:00 is after stoptime 10:00, returned state is stopped
2018-03-09 - 11:00:16.434 - DEBUG : Checking conditions for period "backup-hours"
2018-03-09 - 11:00:16.434 - DEBUG : [running] Weekday "fri" in weekdays (mon-sun)
2018-03-09 - 11:00:16.434 - DEBUG : [running] Time 12:00 is before starttime 19:00, returned state is any
2018-03-09 - 11:00:16.434 - DEBUG : "Any" state period found for current time in schedule "nightly-stop", desired state is any
2018-03-09 - 11:00:16.434 - DEBUG : Desired state for instance from schedule "nightly-stop" is any, last desired state was stopped, actual state is running
Anyone with suggestions is welcome! Thank you!
from instance-scheduler-on-aws.
Can you try this:
scheduler-cli create-period --name period-1 --begintime 19:00 --endtime 23:59 --stack InstanceScheduler
{
"Period": {
"Endtime": "23:59",
"Type": "period",
"Name": "period-1",
"Begintime": "19:00"
}
}
scheduler-cli create-period --name period-2 --begintime 00:00 --endtime 10:00 --stack InstanceScheduler
{
"Period": {
"Endtime": "10:00",
"Type": "period",
"Name": "period-2",
"Begintime": "00:00"
}
}
scheduler-cli create-schedule --name every-night --periods period-1,period-2 --stack InstanceScheduler --timezone Europe/Rome
{
"Schedule": {
"RetainRunning": false,
"Enforced": false,
"Name": "every-night",
"StopNewInstances": true,
"Periods": [
"period-1",
"period-2"
],
"Timezone": "Europe/Rome",
"Type": "schedule"
}
}
You can simulate and see your savings using the following period that shows the running hours/periods in a defined period.
scheduler-cli describe-schedule-usage --name every-night --stack InstanceScheduler --startdate 20180301 --enddate 20180308
{
"Usage": {
"2018-03-01": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/01/18 19:00:00",
"End": "03/01/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/01/18 00:00:00",
"End": "03/01/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-02": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/02/18 19:00:00",
"End": "03/02/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/02/18 00:00:00",
"End": "03/02/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-03": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/03/18 19:00:00",
"End": "03/03/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/03/18 00:00:00",
"End": "03/03/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-04": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/04/18 19:00:00",
"End": "03/04/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/04/18 00:00:00",
"End": "03/04/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-05": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/05/18 19:00:00",
"End": "03/05/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/05/18 00:00:00",
"End": "03/05/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-06": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/06/18 19:00:00",
"End": "03/06/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/06/18 00:00:00",
"End": "03/06/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-07": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/07/18 19:00:00",
"End": "03/07/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/07/18 00:00:00",
"End": "03/07/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
},
"2018-03-08": {
"BillingHours": 15,
"RunningPeriods": {
"Period-1": {
"Begin": "03/08/18 19:00:00",
"End": "03/08/18 23:59:00",
"BillingHours": 5,
"BillingSeconds": 17940
},
"Period-2": {
"Begin": "03/08/18 00:00:00",
"End": "03/08/18 10:00:00",
"BillingHours": 10,
"BillingSeconds": 36000
}
},
"BillingSeconds": 53940
}
},
"Schedule": "every-night"
}
from instance-scheduler-on-aws.
I have the exact same issue. Two periods , one that stops at 02:00 (lets call it abc) and one that starts at 08:00 (lets call it xyz)
So i assigned Schedule123 with periods {abc, xyz} but this doesnt work either. The state table for all tagged instances shows "any" state
i really would like to get this fixed or a solution for this.
from instance-scheduler-on-aws.
In order configure this you need the following periods
Tue-Sat, start 0:00, stop 2:00
Mon-Fri, start 08:00, stop 23:59
A schedule containing these periods
Starts at workdays at 8am and stops on the next day at 2am.
A fix for an issue that might stop/start at midnight has been deployed to aws answers from where you can update your stack
Regards,
Arie
from instance-scheduler-on-aws.
Thanks for the reply, only issue with this is i have things running on these machines closer to 2am, if i run the proposed solution this will stop the instance at 23:59. If i am not mistaken?
from instance-scheduler-on-aws.
The latest maintenance release 2.2.2 that is on aws labs wil detect that there is an adjacent period at 0:00 and will keep the Instance running.
from instance-scheduler-on-aws.
amazing, thanks for that info. Will try that out and report back.
edit this solution above worked. Thank you
from instance-scheduler-on-aws.
Closing due to time elapsed since last correspondence. Please re-open this if you are still having an issue.
from instance-scheduler-on-aws.
I have a similar situation. But here i don't want to mention the start or end time. I just want to mention the amount of time. Suppose if instance starts at 07:00 Hrs, it should be stopped after 2 Hours at 09:00 Hrs... or if it has started at 11:00 Hrs after 2 hours, it should stop at 13:00 Hrs.
from instance-scheduler-on-aws.
Related Issues (20)
- Latest version of CloudFormation template is not deployed in official s3 bucket HOT 1
- Feature Request: Allow multiple timezones HOT 6
- CLI Documentation: --use-metrics not a valid option HOT 2
- CloudWatch alarm enable and disabl HOT 12
- Instance Scheduler should allow for instance type flexibility HOT 4
- DynamoDB enable deletion protection for tables HOT 2
- Support for Israel(Tel Aviv) Region "il-central-1" HOT 3
- Can't start instance without correct KMS permissions HOT 1
- Report Negative Scheduling Patterns HOT 4
- Logger does not show any thing HOT 1
- 'Hibernate' flag doesn't work as documented HOT 2
- Databases of cluster doesn't stop HOT 3
- scheduler-cli Timezone Error HOT 3
- Holiday shutdown HOT 1
- DynamoDB State DB miss reporting correct state of EC2 Instance HOT 5
- Provide a way to specify weekdays after an nth weekday HOT 1
- Skip the stopping of an instance when 'in use' HOT 1
- Invalid PhysicalResourceId and Received response status [FAILED] from custom resource HOT 5
- maximum accounts HOT 1
- ASG support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instance-scheduler-on-aws.