OCI-AutoScale; Now supports 8 OCI Service, including Exadata CS and Network Load Balancers

By | October 1, 2020

2 years ago I started work on the OCI-AutoScaling script. I wanted to run my workloads on OCI as efficiently as possible. So workloads that I did not need in the evenings or weekends could automatically be turned off orscaled down.

With the new release this OCI-AutoScaling script now support 8 OCI services!

Based on an hourly schedule, configured by a Scheduling TAG, you can initiate the following operations:

  • Compute VMs: On/Off
  • Instance Pools: On/Off and Scaling (# of instances)
  • Database VMs: On/Off
  • Database Baremetal Servers: Scaling (# of CPUs between 1 and 52)
  • Database Exadata CS: Scaling (# of CPUs between 2 and 400)
  • Autonomous Databases: On/Off and Scaling (# of CPUs between 1 and 128)
  • Oracle Digital Assistant: On/Off
  • Oracle Analytics Cloud: On/Off and Scaling (between 2-8 oCPU and 10-12 oCPU)
  • Oracle Integration Service: On/Off
  • Load Balancer: Scaling (between 10, 100, 400, 8000 Mbps)*

This script needs to run hourly and you can use an Always Free Compute instance to do this. Here is a youtube video demonstrating how you can implement this: Youtube demonstration video: https://youtu.be/veHbyvDB74A

The full project can be found on github: https://github.com/AnykeyNL/OCI-AutoScale

7 thoughts on “OCI-AutoScale; Now supports 8 OCI Service, including Exadata CS and Network Load Balancers

  1. Pete

    Hi Richard, I tried the recent update (via the install.sh), but am now getting a new error, any ideas ?

    [opc@autoscaler OCI-AutoScale]$ /usr/bin/python3 /home/opc/OCI-AutoScale/AutoScaleALL.py down
    Using Instance principle
    Starting Auto Scaling script, executing Down actions
    Logged in as: Instance Principle/imaginecorp @ iad
    Enabled regions: us-ashburn-1 us-phoenix-1
    Day of week: Saturday – Weekday: False – Current hour: 13
    Checking: sroh-xgljob1-qa01-us3 – PrivateIp
    Traceback (most recent call last):
    File “/home/opc/OCI-AutoScale/AutoScaleALL.py”, line 347, in
    schedule = resourceDetails.defined_tags[PredefinedTag]
    NameError: name ‘resourceDetails’ is not defined

    1. richard Post author

      What kind of resource is sroh-xgljob1-qa01-us3 – PrivateIp?

    2. richard Post author

      I think you have a schedule tag on a non-supported resource. If added a fix to not process those. Update the code and check if you still get the same error.

      1. Pete

        Thanks Richard (it is a VM instance), I applied the latest code and it’s working like a charm now. I did a quick calculation, and if my math is right then I would expect to see the following savings once I get my schedules defined (almost too good to be true?).

        weekends off = 28%
        weekends and weeknights off = 65%

        1. richard Post author

          That is great to hear! If you want to write a guest blog about your experience, feel free to volunteer 🙂

  2. Jesus Montoya

    Hi Richard,
    After using this command python3 CreateNameSpaces.py, I get the following error, what can I do?
    [opc@vm-terraform OCI-AutoScale]$ python3 CreateNameSpaces.py
    /usr/lib/python3.6/site-packages/oci/packages/cryptography/hazmat/bindings/opens sl/binding.py:179: CryptographyDeprecationWarning: OpenSSL version 1.0.2 is no l onger supported by the OpenSSL project, please upgrade. The next version of cryp tography will completely remove support for it.
    Traceback (most recent call last):
    File “CreateNameSpaces.py”, line 41, in
    compartment = identity.get_compartment(compartment_id=SearchCompID).data
    File “/usr/lib/python3.6/site-packages/oci/identity/identity_client.py”, line 4321, in get_compartment
    File “/usr/lib/python3.6/site-packages/oci/base_client.py”, line 263, in call_ api
    return self.request(request)
    File “/usr/lib/python3.6/site-packages/oci/base_client.py”, line 384, in reque st
    self.raise_service_error(request, response)
    File “/usr/lib/python3.6/site-packages/oci/base_client.py”, line 554, in raise _service_error
    oci.exceptions.ServiceError: {‘opc-request-id’: ‘3ACEF5FCDE434B6D87E49CA3EFE9227 7/2EF6A5158AC660EFAE6BA481B4A8C7A4/46375D1E8FBF659356CA82F0383518F0’, ‘code’: ‘N otAuthorizedOrNotFound’, ‘message’: ‘Authorization failed or requested resource not found’, ‘status’: 404}
    [opc@vm-terraform OCI-AutoScale]$

    1. richard Post author

      Did you configure your oci-cli tool with the right credentials?

      You need to run ‘oci setup config’, go thru the wizard. After that add the created public key to your user’s profile on OCI as API key.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.