Skip to main content
  1. posts/

Stop Oracle Cloud powering off your VM on free tier.

·2 mins
Table of Contents

Oracle Cloud Infrastructure (OCI) Free Tier is an excellent option for developers and small businesses to test and deploy applications on the cloud without incurring significant costs. However, the Free Tier has specific resource limits and usage restrictions that you should be aware of, especially when it comes to virtual machines (VMs).

1) The problem #

It all beginnings with an email that I had received from Oracle:

Oracle has implemented a feature that automatically shuts down any VM that is not using enough processing power or have been idle for a specific period. So if you are like me and host there VM, then yes Oracle can shut it down anytime they feel your VM is “idle”. Here are the conditions for reclaiming your VM:

  • CPU utilization for the 95th percentile is less than 15%
  • Network utilization is less than 15%
  • Memory utilization is less than 15% (applies to A1 shapes only)

If you machine produces less CPU power then specified, Oracle will reclaim your VM by powering it off. I haven’t found any information that Oracle would also reclaim storage so yours (and mine) data should be safe for now.

2) Solution? #

This sucks, but there is a simple hack to avoid unexpected shutdowns. One option is to deploy on your Oracle VM simple script. First you need to install stress utility like this:

apt-get install stress

Example is for ubuntu systems but for any different OS look over here. Then create simple bash script like this:

sleep $(( RANDOM % 3000 ))

# This script generates random stress for 5 times
for i in {1..5}
    echo "Running stress test $i"
    stress -c $(( $RANDOM % 2 + 1 )) -t $(( $RANDOM % 60 + 1 ))

Make it executable and deploy crontab job that for every hour:

* * * * /path/to/

With this hack you should be fine. I am myself testing this as well and so far I don’t have any issues. 🤞