Switching off non-production: schedules for two working weeks
Development and test environments sit idle for most of the week. How to schedule them off across the Gulf, where the working week depends on the country.
By DevOps.ae. Published 25 November 2026. 5 minute read.
There are 168 hours in a week. A team that works twelve-hour days, five days a week, uses 60 of them. An environment that runs all week for that team is idle 64% of the time, and on most clouds you pay for idle compute at the same rate as busy compute.
Scheduling non-production environments is usually the fastest saving available on a cloud bill. It needs no architectural change and no negotiation with a vendor. It does need care in the Gulf, for a reason that does not apply in most other regions.
The Gulf has two working weeks
The UAE works Monday to Friday. Saudi Arabia, Qatar, Kuwait, Bahrain and Oman work Sunday to Thursday. A schedule copied from a European or American team gets the weekend wrong for five of the six countries, and a schedule written for Riyadh locks a Dubai team out every Friday.
Cron numbers the days from Sunday as 0, so the two weeks are written like this:
| Where the team works | Working days | Cron days |
|---|---|---|
| UAE | Monday to Friday | 1-5 |
| Saudi Arabia, Qatar, Kuwait, Bahrain, Oman | Sunday to Thursday | 0-4 |
| A team split across both | Sunday to Friday | 0-5 |
A shared environment used from both Dubai and Riyadh has to be up six days a week. Twelve hours on six days is 72 hours, so it is still off 57% of the time.
The clocks never change
No Gulf state observes daylight saving time. The UAE and Oman are at UTC+4 all year. Saudi Arabia, Qatar, Kuwait and Bahrain are at UTC+3.
That makes schedules simpler than elsewhere. If your scheduler only understands UTC, 07:00 in Dubai is always 03:00 UTC and you never have to revisit it. Where the scheduler accepts a time zone, name it anyway (Asia/Dubai, Asia/Riyadh), because the next person to read the schedule should not have to do the arithmetic.
What to switch off, in order
Start with what is stateless, because it restarts cleanly.
- Application compute. Scale Kubernetes workloads and their node groups to zero, or set auto scaling groups to zero instances.
- Databases. Managed databases can usually be stopped and started. Check the provider's small print: on Amazon RDS a stopped instance is started again automatically after seven days, so a schedule has to keep stopping it.
- Whole clusters. A managed Kubernetes control plane is billed by the hour whether or not it has nodes. For short-lived test clusters it can be cheaper to create and destroy them from code than to keep them.
Leave alone anything that other environments depend on at night: shared build runners, artefact registries, and the monitoring that would tell you a morning start had failed.
Scheduling Kubernetes workloads
KEDA's cron scaler holds a workload at a replica count inside a time window and lets it fall to its minimum outside. With a minimum of zero, the workload disappears in the evening and returns in the morning.
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: api-working-hours
spec:
scaleTargetRef:
name: api
minReplicaCount: 0
triggers:
- type: cron
metadata:
timezone: Asia/Dubai
start: 0 7 * * 1-5
end: 0 19 * * 1-5
desiredReplicas: "2"
Once the pods are gone, a node autoscaler such as Karpenter or the cluster autoscaler removes the nodes they were running on. That second step is where the money is, so confirm it happens: a node kept alive by one forgotten pod costs the same as a full one.
Scheduling instances
Outside Kubernetes, scheduled actions on an auto scaling group do the same job. In Terraform:
resource "aws_autoscaling_schedule" "start" {
scheduled_action_name = "working-hours-start"
autoscaling_group_name = aws_autoscaling_group.dev.name
recurrence = "0 7 * * 0-4"
time_zone = "Asia/Riyadh"
min_size = 1
max_size = 4
desired_capacity = 2
}
resource "aws_autoscaling_schedule" "stop" {
scheduled_action_name = "working-hours-stop"
autoscaling_group_name = aws_autoscaling_group.dev.name
recurrence = "0 19 * * 0-4"
time_zone = "Asia/Riyadh"
min_size = 0
max_size = 0
desired_capacity = 0
}
Azure and Google Cloud have equivalents: start and stop schedules on virtual machine scale sets and instance groups. The schedule is the same in each. Only the resource that carries it differs.
Give people a way to wake it up
Someone will need an environment at ten at night before a release. If the only way to get it is to find the one engineer who knows how, the schedule will be switched off within a month and never switched back on.
Provide a self-service override: a pipeline button, a chat command, or a form that starts the environment and stops it again after a few hours. The override that expires on its own is the one that keeps the saving.
What goes wrong
- Nightly jobs. Builds, data refreshes and test suites that assumed the environment was up at 02:00 now fail. Move them inside the window, or have them start what they need.
- Alerts. Monitoring will report every scheduled shutdown as an outage unless it is told about the window.
- Cold mornings. Start environments an hour before people arrive. Caches are empty and images have to be pulled, and the first person in should not be the one to find out.
- Public holidays. Several holidays in the region follow the lunar calendar and are confirmed shortly before they fall. Do not hard-code them. A switch that says "stay down today" is simpler than a calendar that is wrong.
- State that does not survive a restart. Anything keeping important data on a local disk or in memory needs fixing before it is scheduled, and probably needed fixing anyway.
How much it is worth
The arithmetic is simple enough to do in your head, and our cloud savings calculator does it for your own figures and writes the cron expressions for each country's week. As a rule, if non-production is a third of your compute and currently runs all week, scheduling it is worth around a fifth of your compute bill.
Taggedcostkubernetesautomation