Streamline your Oracle Cloud workflows with Oracle Cloud Infrastructure Command Line Interface (OCI CLI) automation. Leverage OCI CLI to automate provisioning, scaling, and management of your cloud resources, optimizing efficiency and productivity in your Oracle Cloud environment. Oracle Cloud automation can be achieved by installing OCI CLI on Microsoft windows and create and schedule powershell scripts .
Oracle OCI CLI Configuration
Setup OCI CLI and make powershell scripts for auto start and stop of OCI CLI services. After installing OCI CLI in windows as already described in https://www.kaamilant.com/oracle-cloud-oci-cli/, we will call powershell scripts in windows task scheduler to stop or start OCI services. As an example, we will setup auto stop of OCI compute and Analytics instance.
Create Powershell Scripts
We will make two powershell scripts, one for stopping OCI compute instance (stop_ocicompute.ps1) and other for stopping Analytics instance (stop_ocianalytics.ps1).
For compute instance, the cli command is
oci compute instance action --action STOP --instance-id replace-with-instance-ocid

For analytics instance, the cli command is
oci analytics analytics-instance stop --analytics-instance-id replace-with-instance-ocid

Schedule OCI CLI Scripts
Launch windows task scheduler, create a task and enter task name and description.

Define trigger and schedule type in task scheduler.

Choose start a program in action.

Call powershell.exe and pass argument -File and path of script file.


A scheduled task is created and it will run on specific day and time every week. In similar way, we can setup Auto start of OCI analytics service using windows scheduler.
Conclusion
In conclusion, Oracle Cloud Automation using OCI CLI offers organizations a powerful solution for streamlining cloud management, increasing scalability, and enhancing security. By leveraging OCI CLI for automation, businesses can unlock greater efficiency, reduce operational overhead, and accelerate their journey to the cloud. With its simplicity, flexibility, and robust feature set, OCI CLI is the go-to tool for organizations looking to optimize their cloud operations and stay ahead in today’s competitive landscape.
For more information on OCI CLI commands, please refer to https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm