How to use the OCI Resource Scheduler to schedule serverless Functions in Oracle Cloud
This post references How to use Functions in OCI (Python)
You can schedule the Function to run periodically based on a Cron schedule using OCI's Resource Scheduler.
Policies needed
First, you need to give the Resource Scheduler permission to use the Function with the OCI IAM Policies:
allow any-user to use fn-function in compartment compA where all {request.principal.type='resourceschedule', request.principal.id='ocid1.resourceschedule.oc1.iad.aaaaaxxxxxxxxxxx'}
Of course, filtering by ID is optional if you want to allow the Resource Scheduler to invoke all Functions in the tenancy.
Include as well any policies the Function may need to read or access your OCI resources like below:
allow dynamic-group 'lb-fn-dynamic-grp' to inspect load-balancers in tenancy
where lb-fn-dynamic-grp
is a Dynamic Group defined as:
resource.id = 'ocid1.fnfunc.oc1.iad.aaaaaxxxxxxxx'
Create the Schedule
Then, create a Schedule to Start the Function. In Basic mode, you can easily use the buttons to set the schedule, or use Cron mode.
Safe harbor statement
The information provided on this channel/article/story is solely intended for informational purposes and cannot be used as a part of any contractual agreement. The content does not guarantee the delivery of any material, code, or functionality, and should not be the sole basis for making purchasing decisions. The postings on this site are my own and do not necessarily reflect the views or work of Oracle or Mythics, LLC.
This work is licensed under a Creative Commons Attribution 4.0 International License.