Comments (3)
Hi,
yes, you need two periods in the schedule to do this type of scheduling
First create a period that is active from midnight until 1am
$ scheduler-cli create-period --stack InstanceScheduler --name period-midnight-1am --begintime 00:00 --endtime 01:00
{
"Period": {
"Endtime": "01:00",
"Type": "period",
"Name": "period-midnight-1am",
"Begintime": "00:00"
}
}
Then a second one that is active from 6am until midnight (note we use 23:59 as begin must be < than end). The scheduler (make sure you have the latest version installed) will detect that the two periods are adjacent and will not stop the instance at 23:59 as there is the next period that starts one minute later at 00:00)
$ scheduler-cli create-period --stack InstanceScheduler --name period-6am-midnight --begintime 06:00 --endtime 23:59
{
"Period": {
"Endtime": "23:59",
"Type": "period",
"Name": "period-6am-midnight",
"Begintime": "06:00"
}
}
Now create the schedule that contains there periods and also specifies the timezone
$scheduler-cli create-schedule --stack InstanceScheduler --name schedule-stop-between-1am-6am --periods period-midnight-1am,period-6am-midnight --timezone Europe/London
{
"Schedule": {
"RetainRunning": false,
"Enforced": false,
"Name": "schedule-stop-between-1am-6am",
"StopNewInstances": true,
"Periods": [
"period-6am-midnight",
"period-midnight-1am"
],
"Timezone": "Europe/London",
"Type": "schedule"
}
}
Now tag (Using the tag-name "Schedule" assuming you used the default name") the Instance with the name of the schedule "schedule-stop-between-1am-6am"
A great way to check if the schedule is scheduling as you expect is to use the following command that shows which periods are active in a specific date range (default if you don't specify a start/end date is today). As you see the scheduler logic detects the adjacent periods in the schedule.
$ scheduler-cli describe-schedule-usage --stack InstanceScheduler --name schedule-stop-between-1am-6am
{
"Usage": {
"2018-08-17": {
"BillingHours": 19,
"RunningPeriods": {
"Period-6am-midnight": {
"Begin": "08/17/18 06:00:00",
"End": "08/18/18 00:00:00",
"BillingHours": 18,
"BillingSeconds": 64800
},
"Period-midnight-1am": {
"Begin": "08/17/18 00:00:00",
"End": "08/17/18 01:00:00",
"BillingHours": 1,
"BillingSeconds": 3600
}
},
"BillingSeconds": 68400
}
},
"Schedule": "schedule-stop-between-1am-6am"
}
Hope this answers your question
Arie
from instance-scheduler-on-aws.
Hi arieleeuw,
Thank you so much for your response and I apologize for the late response. I some how was able to figure out the same solution base on your other answers in this space and didn't get a chance to get back here to thank you.
This solution worked for me perfectly. Thank you so much again for you time and response.
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.
Related Issues (20)
- Masking schedules between date ranges HOT 5
- Create Period WIth Monthdays Failed HOT 5
- Scheduler config is not honored and default is used HOT 1
- Report inability to start/stop multi-az RDS as WARNING? HOT 1
- Support ignore schedule tag value HOT 1
- Stop and start of EC2 part of an ASG HOT 1
- Instances dont start or stop HOT 2
- DynamoDB not updating following CloudFormation Update HOT 5
- 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
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.