Creating Schedules

You can use Resource Scheduler to create schedules and add resources, dates, start and end times to the schedules, as well as and review and edit the schedule before saving it.

Task Overview

  1. Complete the prerequisites and create the required policies.
  2. Add basic schedule information (schedule name, description, action, and (optionally) tags.
  3. Select a compartment and resources.
  4. Add dates and times to the schedule
  5. Review and save the schedule
  6. Monitor and manage schedules (edit, disable, enable, delete, as needed)

Prerequisites

Before creating a schedule, check the requirements listed here and create the necessary policies to allow users to create schedules and schedules to manage resources.

  1. Administrators, create the required policies described in the next section on this page.
  2. Users, check your access rights and obtain the necessary permissions from the administrator to create schedules.
  3. Before creating a schedule, ensure that you have the following information:
    • The names of the tenancies, compartments, regions, and organizations where the resources are
    • The list of resources that will be affected by the scheduled actions
    • The dates and times of the start and stop actions that will be in the schedules
  4. Check for schedule conflicts. Look for existing schedules that use the same resources that you are scheduling at the same time you're scheduling them.

Required Policies

Important

Before you can create or manage a schedule, you must create a policy to allow you to create a schedule (see Example 1) AND you must create a policy to allow a schedule to manage resources (see Example 2).

Example 1. This policy gives users permission to manage (create, delete, activate, and others.) resource schedules in their tenancy.

General example
Allow group <groupname> to manage resource-schedule-family in tenancy

Specific example
Allow group ResourceScheduleAdmins to manage resource-schedule-family in tenancy

Example 2. This policy gives a resource schedule permission to perform an action on a resource.

When a resource schedule is created, by default, it doesn't have permission to perform the action on target resources, so you must give it permission.

This policy allows a schedule to manage predefined resources such as instances in a compartment.

General example
Allow any-user to manage <resource_type> 
in compartment id <compartment_ocid> where all
{request.principal.type='resourceschedule',
request.principal.id='<ocid_of_resourceschedule>'}

Specific example
Allow any-user to manage instance in
compartment id ocid.compartment.oc1...q7fa where all
{request.principal.type='resourceschedule',
request.principal.id='ocid.resourceschedule.oc1.iad.axgr...dt8zb'}

Authentication and Authorization

This page describes the Identity and Access Management IAM process that is used to ensure secure access to Resource Scheduler.

Each service in Oracle Cloud Infrastructure integrates with IAM for authentication and authorization, for all interfaces (the Console, SDK or CLI, and REST API).

An administrator in your organization needs to set up groups , compartments , andpolicies  that control which users can access which services, which resources, and the type of access. For example, the policies control who can create new users, create and manage the cloud network, launch instances, create buckets, download objects, and so on. For more information, see Managing Identity Domains. For specific details about writing policies for each of the different services, see the Policy Reference.

Example policy

Allow the ResourceScheduleAdmins group to perform administrative operations with resource schedules, including Create, Update, Move, and Delete.

Allow group ResourceScheduleAdmins to manage resource-schedule in tenancy
Note

More policy examples are shown in Example Policies

If you are a regular user (not an administrator) who needs to use the Oracle Cloud Infrastructure resources that your company owns, contact your administrator to set up a user ID for you. The administrator can confirm which compartment or compartments you should be using.

To use any of the Resource Scheduler API operations, you must be authorized in an IAM policy. If you're not authorized, contact the administrator. If you're an administrator who needs to write policies to give users access, see Managing Identity Domains.

  • Adding basic schedule information

    1. On the Resource Scheduler Schedules page, select Create a Schedule. The Create a schedule Basic information page opens. On the Basic Information page:
      1. Enter a schedule name.
      2. Optional: Enter a Schedule description
      3. In the Action to be executed field, select either Start or Stop.
      4. Optional: Select Show advanced options. You can apply tags to your resources to help you organize them according to your business needs. You can apply tags at the time you create a resource, or you can update the resource later with tags. See Adding Tags for information about adding tags to resources. For general information about applying tags, see Resource Tags.

    Adding resources

    Note

    Resource Scheduler currently supports only compute instances and autonomous databases. It may support other resources in future releases. You can use the Resource Type filter to select the type of resource.
    Note

    Resource Scheduler can process only 25 resources per schedule. If you select Dynamic, Resource Scheduler adds the first 25 resources it sees in the queue. You cannot manually select the resources or set the order of the resources that are dynamically added. If you create a second schedule and select Dynamic, Resource Scheduler adds the same set of 25 resources that it did before. To schedule more than 25 resources, create as many schedules as needed, select Static resources, and add up to 25 resources per schedule, in the order you want. For more information, see Dynamic Resource Management and Static Resource Management.
    1. In the left pane of the Create Schedules page, select Resources. The Resources page and the list of existing resources in the selected compartment is displayed.
    2. Select one or more resources from the list of resources or change the selection criteria as described below.
      1. In the Resource selection method field, select the type of resource that you want to manage with the schedule, either Static or Dynamic. When you search for resources, only the type you selected are shown.
      2. In the Search and filter field, use the default selection (compartment All) to search for resources, or select Compartment and use the menu to select a different compartment to search for resources. The following resource types are available to search for.
        • Compartment
        • Resource type
        • Status
        • Tags
      3. The following table shows the resource types and descriptions of each.
    3. Resource Types
      Filter name Description
      Compartment Use the selected default setting (All), or select Compartment to display the Compartment Select menu. In the Compartment Select dialog box, select Ssearch Compartments and use the menu to choose the compartment that contains the resources that you want to schedule. Select Apply Filter to select the compartment or select Clear to close the dialog box without making a selection.
      Display name Select Display name in the list to open the Display Name dialog box. Enter the display name of the resource to search for and select Apply Filter to select it. When the resource is shown in the table, select the checkbox to select it to be used in the schedule. Select Apply Filter to select the display name or select Clear to close the dialog box without making a selection.
      OCID Select OCID in the Enter the OCID of the resource to search for.
      Resource type Select Resource Type in the list to open the Search dialog box. Select either Autonomous Database or (compute) Instance or both. Only the resources of the type you select are shown in the list. Select Apply Filter to select the resource type or select Clear to close the dialog box without making a selection.

      Note: You must list at least one resource type. If you uncheck all selections, no resources are listed and search is disabled.

      Status The default selection is All. To display schedules with a different status, select Status to open the Search menu. Select any or all of the following statuses: Available, Creating, Updating, Deleting, Deleted, Failed, Inactive, Stopped, or Ended.

      Note: If you don't select a status, the dialog box closes without saving a selection.

      Time created Enter the UTC time when the resource was created
    4. Select Apply filter to run the search and display the list of resources that are found.

    Adding Schedule Information

    Use the Schedule page to add dates and times to start and stop the schedule. You can manually enter the information using the UI forms or with a Cron expression, or use the CLI or API to add schedule information.

    Using the UI Forms
    You can use the UI forms to add time information to the schedule. See Using a Cron Expression for information about using Cron to set the schedule.
    1. Enter an interval for the schedule.
    2. In the Interval field, use the menu to select the time interval for the schedule. The choices are:
      • One-time
      • Hourly
      • Daily
      • Weekly
      • Monthly

    Creating a One-time Schedule

    1. Select in the Interval field to display the menu.
    2. Select One-time. The one-time dialog box opens.
    3. In the Time field, enter UTC time in 24-hour format.
    4. Select the calendar icon to select a date and time that the action specified in the schedule will start.
    5. Select Next to review the schedule, including the Basic Information, Resources, and Schedule information.
    6. After reviewing the schedule, select Create to save the schedule. The action (start/stop) runs on the selected resources at the selected date and time.

    Creating an hourly schedule

    1. Select in the Interval field to display the menu.
    2. Select Hourly. The Hourly dialog box opens.
    3. In the Time field, enter UTC time in 24-hour format.
    4. In the Start date field, enter the start date in MM/DD/YYYY format, or use the calendar icon to select a date and time.
    5. To set the end date, select the End date field and use the calendar to enter the end date and time/
    6. Select Previous to go back to the Resources screen, or select Next to go to the Review and Save screen, or select Close to delete the schedule without saving it.

    Creating a daily schedule

    1. Select in the Interval field to display the menu.
    2. Select Daily. The Daily dialog box opens.
    3. In the Repeat every field, enter how often you would like the schedule to run or use the menu to select an interval. The minimum value is 1. The maximum value is 99.
    4. In the Day(s) of the week field, select Select... to choose which days(s) of the week to run the schedule. You can select one or more days of the week, one at a time. Select the X next to a displayed name to delete it from the list of selected days.
    5. In the Start Time field, enter the time in hours and minutes in 24-hour format.
    6. In the Start date field, enter the start date in MM/DD/YYYY format, or use the calendar icon to select a date and time.
    7. To set the end date, select the End date field and use the calendar to enter the end date and time/
    8. Select Previous to go back to the Resources screen, or select Next to go to the Review and Save screen, or select Cancel to delete the schedule without saving it.

    Creating a Weekly Schedule

    1. Select in the Interval field to display the menu.
    2. Select Weekly. The Weekly dialog box opens.
    3. In the Repeat every field, either enter how often you want the schedule to repeat. For example, 1 = every week, 2 = every two weeks, 3 = every three weeks. The minimum number of weeks is 1. The maximum number of weeks is 99.
    4. In the Day(s) of the week field, select the days of the week that you want the schedule to run. You can select one or more days, one at a time. To remove a day, select the X next to the day.
    5. In the Start date field, use the calendar to select a date and time when the schedule starts.
    6. Optional: In the End date field, use the calendar to select the date and time that the schedule ends.
    7. Select Previous to go back to the Resources screen, or select Next to go to the Review and Save screen, or select Close to delete the schedule without saving it.

    Creating a Monthly Schedule

    1. Select in the Interval field to display the menu.
    2. Select Monthly. The Monthly dialog box opens.
    3. In the Repeat every field, enter how often you want the schedule to repeat. For example, 1 = every month, 2 = every two months, 3 = every three months. The minimum number of months is 1. The maximum number of months is 99.
    4. In the Day(s) of the month field, select the number of the day of the month that you want the schedule to run. For example 1 is the first day of the month, 17 is the seventeenth day of the month. You can select one or more days, one at a time. To remove a day, select the X next to the day.
    5. In the Start Time field, use the calendar to select a date and time when the schedule will start.
    6. In the End date field, use the calendar to select the date and time that the schedule will end.
    7. Select Previous to go back to the Resources window, or select Next to go to the Review and Save window, or select Cancel to close the schedule window without saving the schedule.
    Using a Cron Expression

    This page explains how to use a Cron expression to set the schedule. See Using the UI Forms for information about using the UI forms to set the schedule.

    1. In the Schedule window, select Cron to display the Cron window.
    2. Enter a valid Cron expression to set the schedule interval, start date and time, and end date and time. For example, Examples
      30 13 * * mon-fri 
      This expression means every week at 13:30 UTC every Monday, tuesday, Wednesday, Thursday, and Friday.
      0 */2 15 * *
      This expression sets the schedule to run every 2 hours on the 15th day of any month.
    3. In the Start date field, enter the start date manually or use the calendar to select a date
    4. Optional: In the End date field, enter the end date manually or use the calendar to select a date
    5. Select Previous to go back to the Resources window, or select Next to go to the Review and Save window, or select Cancel to close the schedule window saving the schedule.
    Cron Expression Details

    A cron expression is a string of five fields separated by a blank space.

    Enter the cron expression in the following format:

    You can use the following values in a cron expression:

    • <minute>: 0–59
    • <hour>: 0–23
    • <days of month>: 1–31
    • <months>: 1–12 (for January to December)
    • <days of week>: 1–7 (for Monday to Sunday)

    For example, to run the schedule at 23:00 on the 15th day of any month, enter this expression: 0 23 15 * *

    A field can also have the following special characters:
    Special Characters
    Character Description
    * Asterisk: Represents any value.
    , Comma: Separator for more than one value. For example, for <days of week>, 2,3 represents Tuesday and Wednesday.
    - Dash: Range of values. For example, for <days of week>, 1-3 represents Monday through Wednesday.
    / Slash: Step values. For example, for <minute>, */30 represents every 30 minutes.
    Note

    You cannot create a schedule that triggers at an interval of less than 30 minutes. Only intervals of 30 minutes or more are allowed. For example, you can create a schedule with the expression */30 * 15 * * to run the schedule every 30 minutes on the 15th day of any month. You cannot, however, define a schedule with */15 * 15 * *.

    For information about creating Cron expressions, see Creating a Cron Expression Schedule.

    Reviewing a Schedule

    Reviewing and either editing a schedule or creating a new schedule from an existing one is the final step in the process to create a schedule.

    Important

    To manage Resource Scheduler schedules, you must have permissions to access and modify them. For more information, see Authentication and Authorization, Resource Scheduler Policies, and Example Policies.
    1. After completing the major steps (Basic, Resources, and Schedule) to create a schedule, select Review. The Review window includes a separate section for each major step to create a schedule. Each section shows all the information you entered or selected in that part of the process to create a schedule.
    2. Review and edit the information in each section as needed.
    3. When you are finished, the window closes and returns to the list of schedules. While Resource Scheduler creates the schedule, the work request status of the schedule says Creating. When the work request is complete, the status says Succeeded. If the information in the new or updated schedule is invalid, Resource Scheduler returns error 400 (bad request, invalid input). The update request fails and no change is applied to the schedule.
  • Use the Resource Scheduler Create Schedule CLI command and required parameters to create a schedule.

    oci resource-scheduler schedule create --action, --compartment-id | -c, --recurrence-details,
          --defined-tags, --description, --display-name, --freeform-tags, -? | -h | --help,
          --resource-filters, --resources, --time-starts

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Use the Resource Scheduler CreateSchedule API to create a schedule.

    For a complete list of Resource Scheduler APIs, see Resource Scheduler APIs.