Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

The This article instructs on using the EC2/RDS scheduler, which starts and stops EC2/RDS instances based on the cloudaware:scheduler tag value. Schedule The schedule tag value may consist of several fields separated by a spacespaces, with each field in the format key=value.

Table of Contents

IAM Policy

To provide grant Cloudaware with necessary permissions for instance start/stop schedule, 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": [
    "*"
   ]
  }
 ]
}

The policy You can be also downloaded 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 'Please use one of thoseCLOUDAWARE IAM POLICIES'. 

Tag Keys

The list of tag 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:

Code Block
tz=America/New_York

default (required)


Default instance work hours. Can be either numeric or range with a hyphen separated by the slashes /. It also can be the word off which mean that Use off to specify that the instance should be stopped all that day or on which mean  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. Format The format is the same as the key default.

Example 1. Work hours:

Code Block
default=9-16 sat=off sun=off

Instance The instance will be running run from 9:00 to 16:59 all days, except Saturday and Sunday.

Example 2. Work hours:

Code Block
default=off wed=9/14-17

Instance The instance will be running run only on Wednesday from 9:00 to 9:59 and from 14:00 to 17:59.

policy (optional)


Scheduler mode. Can be start_at_time or stop_at_time which mean , meaning that the scheduler will check and change the instance status only at the time defined with keys default and mon .. sun.

...

instance work hours

  • Wednesday: 00:00-5:59;

schedule timezone

  • New York (EST);

This configuration below can be used for instances To configure an instance to operate only from 8 AM to 6 PM on weekdays , and remain off during non-working hours, and also off on weekendsnights 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 tz=America/New_York

...

instance work hours

  • from Monday to Friday: 8:00-18:59;

  • Saturday-Sunday: off

schedule timezone

  • New York (EST);

You can implement For instances that operate across midnight, configure a sophisticated scheduling pattern when configuring instances with operational requirements that cross midnight. For example, to have if an instance operate runs from Monday through Friday, running operating from midnight to 2 AM and again from 10 PM to midnight, use the following schedule 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

...

instance work hours

  • from Monday to Friday: 0:00-2:00 and 22-0-:00;

  • Saturday-Sunday: off

schedule timezone

  • New York (EST);

...