Use scheduled shutdowns to save money and energy

green plant on brown round coins

What is the problem?

Cloud prices are surging and the promise that public cloud would save you money has not been fulfilled. The hyperscalers have locked you in with their services and there aren’t easy ways out. One easily overseen but hard to manage option is to run your VM’s on a schedule to save on cloud costs. Hyperscalers charge you based on usage so it makes sense to do some kind of orchestration.

On top of that, our planet is at risk and it makes sense to cut energy consumption.

How do you start?

I think it is really important to create awareness that running VM’s is not a free ride. It’s also not very sustainable. The world eats data but this all comes with a costs for our planet. Using serverless architecture is the best way to be more sustainable and better for our planet.

You need to make a plan for scheduling some of your services. First candidates to save money on are developer machines. Developers tend to leave public cloud facilities on, not being aware of the fact that this is expensive. So the first thing you can do is to make a list of developers and the VM’s they use and when they need them. Probably most of the time they need these machines during working hours.

Second candidates are solutions that don’t need to run 24 hours a day. Think of machines that run logistical processes during the day or do document processing.

What are the drawbacks?

When it comes to running virtual servers you need to make sure machines get back into their original state when started again. Sometimes this can be done in the software solutions itself and sometimes it needs to be done at the server level. 

Do you run nightly backups? Make sure to schedule carefully.

Office hours

two women sitting in front of white table

It’s clear that most people work between 09:00 and 17:00 in the US and Europe. In Asia people tend to work slightly longer.

The easiest step to save money is to shutdown your machines outside office hours.

Which tools do you need?

assorted color plastic tools on gray wooden table

Pick any tool you like as long as it can support scheduling and API’s. Below is a list of the tools that can work:

  • Zapier
  • Make.com
  • N8N
  • cron
  • Activepieces
  • Directus
  • Pipedream
  • Power automate
  • Postman

Besides the tools you need to have the possibility to manage your cloud services with an API. The following cloud providers have some API’s in place:

  • Vultr
  • Digital Ocean
  • whitesky.cloud
  • AWS
  • Azure

We run parts of our services at Digital Ocean, and yes we schedule some of our VM’s. 

DigitalOcean Referral Badge

Digital Ocean is not our sponsor but we use their affiliate system. We use their products on a daily basis for customers and internal projects.

A sample

The sample we provide is based on Digital Ocean and their API. We first tested the API with Postman and then we hooked it up with Pipedream (just in this case).

The first thing you need is the URL of the API. The base URL is:

https://api.digitalocean.com/v2/droplets/<droplet_id>/actions

The JSON payload that you need to send for a power off is:

{“type”: “power_off”}
 
Authorization is done by using a Bearer token which can be created in the Digital Ocean management environment. 

To make it work you also need a Droplet ID which can also be found in the Digital Ocean Dashboard.

When using the power off you also need to send a shutdown after 1-2 minutes. This can be done by using a different payload which contains shutdown.

Below you can see the workflow done in Pipedream.

It makes a lot of sense to use schedules and even notify user about the status of their machines. And yes, using cloud services to schedule things also costs money and energy but compared to machines running at night it is still a reasonable thing to do.

Interesting reads

Is your organisation ready to cut cloud costs?

Related Post

Leave a Reply