Streamlining Operations and Slashing Cloud Costs: A Budget-Friendly Approach to Task Automation
Streamlining Operations and Slashing Cloud Costs: A Budget-Friendly Approach to Task Automation
“Cronicle” is an open-source project. Cronicle is a task scheduler and job runner that allows users to schedule and automate various tasks and processes on a server or computer system. It is designed to be simple, lightweight, web based and easy to use. Here are some common use cases and examples of how Cronicle can be used.
Scheduled Tasks
Data Processing and ETL
Report Generation
System Maintenance and Cleanup
Batch Processing
Integration with External Systems
I’ve employed Cornicle in multiple projects to automate specific tasks within Oracle Cloud Infrastructure (OCI), leading to a substantial reduction in universal credit consumption. Here are the key tasks at a high level
Stop/Start VM Instances
Stop/Start DBCS, EXACS
Scale Up/Down Resources (VMs, DBCS, EXACS)
High-Level Implementation Steps as follows
Step 1
Provision “Always Free-eligible” VM in OCI
Arm-based processor
Shape: VM.Standard.A1.Flex
Image: Oracle-Linux-8.7-aarch64
OCPU count: 1
Network bandwidth (Gbps): 1
Memory (GB): 6
Step 2
Install the Oracle Cloud Infrastructure (OCI) SDK in Oracle Linux 8 (OEL 8), you can follow these steps
Set up the prerequisites
Ensure you have Python 3.6 or later installed on your system.
Verify that pip (the Python package installer) is installed. You can check by running the following command
pip --version
Install the OCI SDK package
pen a terminal or command prompt.
Run the following command to install the OCI SDK package using pip
pip install oci
Verify the installation
Run the following command to check that the OCI SDK is installed correctly:
python -c “import oci; print(oci.__version__)”
Follow the prompts to enter your OCI credentials, including your user OCID, tenancy OCID, region, and path to the private key file.
After completing the configuration, the CLI will generate a configuration file (~/.oci/config) and a private key file (~/.oci/oci_api_key.pem)
Start using the OCI SDK
You can now use the OCI SDK in your Python scripts to interact with Oracle Cloud Infrastructure resources. Import the oci module in your Python code and use the provided classes and methods to interact with OCI services
Step 3
Install Cronicle in OEL 8 , add events and schedule tasks using OCI CLI commands.
Plugin: Shell Script
Example as follows.
To Scale down EXACS VM Cluster
#!/bin/sh
oci db cloud-vm-cluster update -- cloud-vm-cluster-id ocid1.cloudvmcluster.oc1.ap-singapore-1.xxxxx cpu-core-count 0
To Scale up EXACS VM Cluster
#!/bin/sh
oci db cloud-vm-cluster update --cloud-vm-cluster-id ocid1.cloudvmcluster.oc1.ap-singapore-1.xxxx -- cpu-core-count 4
To Start DBCS VM
#!/bin/sh
oci db node start--db-node-id ocid1.dbnode.oc1.ap-singapore-1.xxx
To Start OCI VM Instance
#!/bin/sh
oci compute instance action --action start --instance-id ocid1.instance.oc1.ap-singapore-1.xxx