Creating a Resource Scheduler Schedule

Create a Resource Scheduler schedule to reduce the costs of resources in your tenancy by automatically starting and stopping them as needed.

For prerequisite information, see Resource Scheduler Schedules.

  • On the Schedules list page, select Create schedule. If you need help finding the list page, see Listing Resource Scheduler Schedules.

    Creating a Resource Scheduler schedule consists of completing the following pages:

    Run each of the following workflows in order. You can return to a previous page by selecting Previous.

    General information

    The General information page is where you provide the basic information for the schedule.

    Enter the following information:

    • Schedule name: Enter the name of the schedule you're creating.
    • Schedule description: (Optional) Provide an description of the schedule.
    • Action to be executed: Select one of the following actions to be applied to the schedule:
      • Start
      • Stop
    • Resource selection method: Select one of the following resource selection methods:
      • Static: This option applies the schedule to the specific named resources. If you select this option, all the available resources are listed in the page. Select the checkbox for the ones you want to include in the schedule. You can specify a compartment and apply filters to narrow the list of available resources. This process is described later in the following section.
      • Dynamic: This option applies the schedule to all resources meeting search criteria at time of the schedule's running. If you select this option, all the resources listed in the page are automatically included in the schedule. You can specify a compartment and apply filters to narrow the list of available resources. This process is described later in the following section.
    • Compartment: Select the compartment where the schedule reside.
    • Tags: Select Add tag. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.

    Select Next.

    Resources

    The Resources page is where compute instances and autonomous databases and may support other resources in future releases.

    Search and filter: Use the filter options to find and limit the resources for both static and dynamic resource selection. The following resource types are available to search for:

    • Compartment: Navigate to the compartment you want to find resources in if you don't want to accept the default compartment All to search for resources. The compartment you select is listed in the Search and filter box. If you delete your selection, the default compartment All is used.
    • Resource type: Select one or more of the following resource types:
      • Instance
      • InstancePool
      • AutonomousDatabase
      • Function
    • Status: Select Select all or select one or more of the following status types:
      • AVAILABLE
      • RUNNING
      • STOPPED
    • Tags: Select a tagging type from the list and enter the corresponding value to search resources for.

      Select Match any value or select Specify matching values and enter the value to be matched. Select the + to add additional matching values.

    In addition to applying preset filters, you can also enter your own search filters based on the information categories of the resources. Any resource that has things in common with the filter terms you enter are displayed, with the closest matches on on top.

    The following table shows the resource types and descriptions of each.

    Resource Filters
    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 Search Compartments and use the menu to select 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 clear 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 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

    Select Next.

    Apply parameters

    The Apply parameters page is where you add parameters to selected resources when you create or edit a schedule. Use of the Apply parameters features is optional and might not be enabled when you're creating your schedule.

    1. Select a parameter from the Parameter list.
      Note

      Resource Scheduler only supports the Body parameter on the Function resource.
    2. Enter a JSON value for the parameter.
    3. Select one or more resources to apply the parameter to.

    Select Next.

    Schedule

    The Schedule page is where you add dates and times to start and stop the schedule. You can manually enter the information using the Form interface or with a Cron expression.

    Enter the following information:

    Select one of the following schedule types:

    Each of these schedule types is described in the following sections.

    Note

    Resource Scheduler uses UTC time only. It doesn't automatically change schedule times when local time changes from standard time to daylight savings time or from daylight savings time to standard time.

    Form Interface

    You can use the Form interface to add time information to the schedule, to select a compartment for the schedule, and to configure other parameters for the schedule.

    Enter the following information:

    • Interval: Select the time interval from the list. Options include One-time, Hourly, Daily, Weekly, and Monthly.
    • Repeat every: Enter the number of interval periods you previously selected that the scheduled activity take place. The interval period is displayed next to the box. For example, if you wanted the schedule to occur every two weeks, enter "Weekly" for the Interval and "2" for Repeat every.
    • Day(s) of the week: (weekly and monthly intervals only) Select the days of the week that the schedule runs.
    • Time: Enter the UTC time in 24-hour format. For example, 1:00pm would be 13:00.
    • Start date: Enter the date or use the calendar tool to specify the start date.
    • End date: (Optional) Enter the date or use the calendar tool to specify the end date.

    You can't create a schedule that triggers at an interval of less than one hour. Only intervals of one hour or more are allowed. However, you can create two 1-hour schedules for the same operation on the same resources that start 30 minutes apart to accomplish the same thing as running a schedule every 30 minutes. While each schedule operates hourly, they run every 30 minutes, taking turns.

    For example: you can create a schedule to run hourly with a start time as 12:00 p.m. on a list of instances, and another schedule that runs hourly with the same action and set of instances, with a start time as 12:30 p.m., The action is effectively performed every 30 minutes, even though each schedule has an hourly interval.

    Cron Schedules

    You can use a cron expression to set the schedule.

    Enter the following information:

    • Recurrence details: (Optional) Enter any details related to the recurrence of the cron schedule.
    • Time: Enter the UTC time in 24-hour format. For example, 1:00pm would be 13:00.
    • Start date: Enter the date or use the calendar tool to specify the start date.
    • End date: (Optional) Enter the date or use the calendar tool to specify the end date.

    A cron expression is a string of five fields, each separated by a blank space. Enter the cron expression in the following format, using the following values:

    • <minute>: 0 to 59
    • <hour>: 0 to 23
    • <days of month>: 1 to 31
    • <months>: 1 to 12 (for January to December)
    • <days of week>: 1 to 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 to 3 represents Monday through Wednesday.
    / Slash: Step values. For example, for <hour>, */3 represents every 3 hours.

    You can't create a schedule that triggers at an interval of less than one hour. Only intervals of one hour or more are allowed. For example, you can create a schedule with the expression 0 * 15 * * to run the schedule every hour on the 15th day of any month. You can't define a schedule with */15 * 15 * * which would be every 15 minutes on the 15th day of any month.

    Important

    Resource Scheduler does not support the 30 minute interval shown on that page. The minimum Resource Scheduler interval is one hour.

    However, you can create two 1-hour schedules for the same operation on the same resources that start 30 minutes apart to accomplish the same thing as running a schedule every 30 minutes. While each schedule operates hourly, they run every 30 minutes, taking turns.

    For example, you can create a schedule to run hourly with a start time as 12:00pm on a list of instances, and another schedule that runs HOURLY with the same action and set of instances, with a start time as 12:30pm. The action is effectively performed every 30 minutes, even though each schedule has an hourly interval.

    Resource Scheduler uses UTC time only. It doesn't automatically change schedule times when local time changes from standard time to daylight savings time or from daylight savings time to standard time.

    Enter a valid Cron expression to set the schedule interval, start date and time, and end date and time. For example:

    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.

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

    Select Next.

    Review

    Review the contents of the Review page. Select Edit to update the settings in any of the sections. When the settings are fully verified, select Create schedule. The schedule you created appears in the Schedules list page.

  • Use the oci resource-scheduler schedule create command and required parameters to create a schedule.

    oci resource-scheduler schedule create --action (START_RESOURCE | STOP_RESOURCE) 
    --compartment-id compartment_ocid recurrence-type (CRON | ICAL)
    --recurrence-details recurrence_details [OPTIONS]

    recurrence-type can be one of the following:

    • ICAL: RFC-5545 formatting
    • CRON: UNIX cron

    recurrence_details is the frequency of recurrence of a schedule. The frequency field can either conform to RFC-5545 formatting or UNIX cron formatting for recurrences, based on the value specified by the recurrence_type parameter.

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

  • Run the CreateSchedule operation to create a Resource Scheduler schedule.