Info |
---|
The This article instructs on using the EC2/RDS scheduler, which starts and stops EC2/RDS instances based on the |
Table of Contents |
---|
IAM Policy
To enable instance start/stopgrant Cloudaware necessary permissions, apply the following Instance Scheduler policy in your AWS console:
Code Block |
---|
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CaInstanceScheduler",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:StartInstances",
"ec2:StopInstances",
"rds:DescribeDBInstances",
"rds:ListTagsForResource",
"rds:StartDBInstance",
"rds:StopDBInstance"
],
"Resource": [
"*"
]
}
]
} |
You can also download the policy in your Cloudaware account. For that, go to Admin → AWS Accounts → ADD AMAZON ACCOUNT → Using Access & Secret Keys → select Instance Scheduler in 'CLOUDAWARE IAM POLICIES'.
Tag Keys
The list of
...
Apply the following keys in tags on instances that should be scheduledtag keys that are used to set up instance start/stop:
Key | Description |
---|---|
tz (required) | Timezone to be used by the scheduler. |
Use Area/Location style from IANA Time Zone Database |
:
|
Example 2. Timezone Area/Location style:
| |
default (required) | Default instance work hours. Can be either numeric or range with a hyphen separated by |
slashes |
off
which mean that Use |
to specify that the instance should be running. The work hours should be specified in 24-hour format. | |
mon, tue, wed, thu, fri, sat, sun (optional) | Instance work hours for the current day. |
The format is the same as the key Example 1. Work hours:
|
The instance will |
run from 9:00 to 16:59 all days, except Saturday and Sunday. Example 2. Work hours:
|
The instance will |
run only on Wednesday from 9:00 to 9:59 and from 14:00 to 17:59. | |
policy (optional) | Scheduler mode. Can be |
, meaning that the scheduler will check and change the instance status only at the time defined with keys |
Learn more about tagging resources in Cloudaware here.
Tag Examples
Code Block |
---|
tz=UTC default=9-17 sat=9-11/15-17 sun=off tz=America/New_York |
Description:
schedule timezone
UTC;
instance work hours |
|
schedule timezone |
|
Use the 'default=off' to specify exceptions in work hours for an instance. The instance will be off all time, except for specific periods, for example:
Code Block |
---|
default=off wed=0-5 tz=America/New_York |
Description:
instance work hours |
|
schedule timezone |
|
To configure an instance to operate only from 8 AM to 6 PM on weekdays and remain off during nights and weekends, use the following schedule:
Code Block |
---|
mon=8-18 tue=8-18 wed=8-18 thu=8-18 fri=8-18 sat=off sun=off default=off |
...
Description:
...
schedule timezone
...
tz=America/New_York |
Description:
instance work hours |
|
schedule timezone |
|
For instances that operate across midnight, configure a sophisticated scheduling pattern. For example, if an instance runs from Monday through Friday, operating from midnight to 2 AM and again from 10 PM to midnight, the configuration may be:
Code Block |
---|
mon=0-2/22-24 tue=0-2/22-24 wed=0-2/22-24 thu=0-2/22-24 fri=0-2/22-24 sat=off sun=off default=off tz=America/New_York |
Description:
instance work hours |
|
| |
schedule timezone |
|
This approach allows for precise control over resource utilization and cost management.