How-to guide

Schedule non-production environments on Oracle Cloud

Learn how to put Oracle Cloud dev and test environments on a working-hours schedule using Resource Scheduler, tags, and checks that catch drift.

By the Cloudverg engineering team · · 6 min read

Why this matters

Non-production environments on Oracle Cloud are built to sit idle. A dev compute instance, a test load balancer and a staging database can run all night while nobody uses them. Compute instances stop billing when they are stopped, but the boot volume, block volumes and load balancer keep their charges.

Oracle Cloud Infrastructure gives you Resource Scheduler for compute instances and, depending on the resource type, some managed databases. You define a recurring start and stop time, attach resources, and let the service call the APIs. That removes the manual console work and the forgotten Friday shutdown. It also makes the schedule visible to testers and developers.

The trade-off is control. A stopped instance is not a deleted instance, so storage remains. A start can fail if the availability domain has no capacity. Databases need clean shutdown steps. Shared services such as a bastion or CI runner should stay up if other teams depend on them. Treat scheduling as an operations change, not a cost trick.

Before you start

Start with an inventory, not a schedule. In the OCI Console, filter Compute instances by compartment and tag. Use a defined tag such as Environment with values dev, test and staging, and a second tag such as Schedule with values office-hours or always-on. If tags are missing, fix them first. Tags make the next review possible.

List dependencies for each environment. A test app server may need a database, a load balancer, a file system and a NAT gateway. Stopping the app server alone saves little if the database and load balancer stay up. Decide the boundary: stop the whole stack, or stop only the compute tier and leave data services running.

Check permissions. The group that runs the schedule needs manage resource-schedules and use instances in the target compartments. Keep the schedule in a shared operations compartment. Decide the time zone now, because a schedule set to UTC will stop a team's environment in the middle of their afternoon. Write down who can pause a schedule and where they record the pause.

How to do it

Build the schedule in Resource Scheduler, then attach only the resources that are safe to stop. Keep the first version small: one compartment, one environment, one start time and one stop time. Run it for a week before you add the next environment. That gives you one clean failure to debug.

For resources that Resource Scheduler does not cover, use a small runner. A function or a compute instance with the OCI CLI can stop an Autonomous Database, delete a temporary load balancer or scale a node pool. Put the runner on its own schedule and log every action. Do not put database shutdown steps in a user data script that only runs at boot.

Order matters. Stop the application tier before the database, and start the database before the application. Allow wait time between steps. Add a post-start check that calls the app health endpoint and writes the result to a log.

  1. Tag and group the non-production resources. Apply Environment and Schedule tags to every instance, database and load balancer in scope. Group the resources in a compartment or a tag-based query you can review. This list is the source of truth for what the schedule may stop.
  2. Create a recurring schedule in Resource Scheduler. In the OCI Console, open Resource Scheduler and create a schedule with a start and stop time. Choose the resource type and set the time zone to the team's working time zone. Start with one daily stop and one daily start before adding weekend rules.
  3. Attach only the safe resources. Attach instances that have no local state and can tolerate a stop. Leave shared bastions, CI runners and always-on services out. Check each instance's boot volume and block volume attachments so you know what persists.
  4. Add pre-stop and post-start checks. Run a pre-stop script that drains the app, stops background jobs and flushes logs. Run a post-start check that waits for the database and calls the health endpoint. Write both results to a log file or OCI Logging.
  5. Handle databases and managed services separately. If Resource Scheduler supports your database type, attach it with a longer stop window. If it does not, use OCI CLI calls from a runner to stop the database. Wait for the lifecycle state to reach STOPPED before you stop the compute tier.
  6. Create an exception path. Add a documented way to pause the schedule for a release or a demo. Record the owner, the reason and the end time. Review open exceptions at the weekly operations meeting.
  7. Set alerts and a weekly review. Create a budget alert for the non-production compartments and a Monitoring alarm for failed start events. Review the schedule's actions once a week. Remove instances that were deleted or moved.
  8. Test a full stop and start cycle. Pick one environment and let the schedule run without manual help. Confirm the app comes back, the database is reachable and the load balancer routes traffic. Fix the runbook before you expand to other environments.

How to check it worked

Check state, not intent. In the OCI Console, open the instance and confirm the lifecycle state is STOPPED, not TERMINATED. Confirm the boot volume still exists and the block volumes are still attached. If the app is still reachable, you probably have a second instance behind a load balancer.

Use OCI Audit. Filter by the Resource Scheduler service and the compartment. You should see start and stop events at the times you set. If events are missing, check the schedule state and the IAM policy. If events exist but the instance did not stop, check for a graceful shutdown timeout or an operating system service that blocks shutdown.

Check the application after each start. Call the health endpoint, check the database connection pool and read the first lines of the app log. A database that is still opening or a file system that is not mounted will show up here.

Check the budget. Compare the non-production compartments before and after the schedule. Compute hours for the instances in scope should fall. Storage, load balancers and always-on services will remain. If the bill does not move, the schedule is stopping the wrong tier.

Mistakes to avoid

The first mistake is scheduling a stateful primary database as if it were a stateless app server. A hard stop can leave the database in recovery. Use the database's own stop command and wait for the lifecycle state. The second is stopping a shared service because it sits in a dev compartment. A bastion, a CI runner or a DNS forwarder may serve several teams. Keep shared services on an always-on list and review that list each quarter.

The third is using terminate instead of stop. A terminate deletes the boot volume unless you preserve it, and a schedule that rebuilds an instance from scratch is a different project. Keep the schedule to start and stop, and use infrastructure as code for rebuilds.

The fourth is ignoring time zones and holidays. Add a holiday exception or a manual pause. Make the time zone part of the schedule review. The fifth is never checking capacity. A stopped instance still needs capacity when it starts. If the availability domain is full, the start fails and the team loses a morning. Test starts during the week.

If cost is the main driver, a scheduling change is one option. A tag cleanup or a commitment plan may matter as much. The Cloud cost audit from Cloudverg is $4,500/month for a fixed two-week read-only review, and it ranks savings across your Oracle Cloud bill. It is one option among others; a simple Resource Scheduler schedule plus a budget alert may be enough for a small team.

Frequently asked questions

Can Oracle Cloud Resource Scheduler stop an Autonomous Database?

Check the resource types offered when you create the schedule, since support can vary by database type and region. If Autonomous Database is listed, attach it and allow a longer stop window. If it is not, use the OCI CLI or a function to call the stop API and wait for the lifecycle state.

Does a stopped Oracle Cloud instance still cost money?

The compute instance stops billing while it is stopped, but the boot volume and any attached block volumes keep billing. A load balancer or NAT gateway in the same environment keeps running until you delete it. Review the whole stack, not just the instance.

How do I pause a schedule for a release weekend?

Disable the schedule or remove the instances from it before the release, then restore it after. Record the owner and the end time in your operations log. Do not rely on a manual start to override a stop that is still active.

Monthly plan

Want help with this? Cloud cost audit

$4,500/month

2 weeks · Starts within 10 business days

A two-week, read-only review of your AWS, Azure, Google Cloud or Oracle bill, with every saving ranked by dollars per month.

Renews monthly. Cancel any time.
What is included

Related guides

More cloud costs guides   Cloud cost audit

Smallest way to start

Get a senior architect on your problem this week

Ninety minutes a month on the cloud, AI or security question that is blocking you, a pre-read of your material and a written summary within two business days.

$450/month

Renews monthly. Cancel any time.