Skip to content
tezvyn:
Menu

Stop Paying for Idle Cloud Resources

Source: mlopscrew.comMediumHow cards are made

Stop Paying for Idle Cloud Resources

Stop paying for idle cloud servers. Automated shutdown is like turning off the lights in an empty office, running compute only when needed. It's ideal for dev environments or scheduled batch jobs. The footgun is applying this to stateful production services.

Why it exists

Cloud providers bill for compute resources as long as they are running, even if they are sitting idle. Many organizations leave non-production environments like development and staging running 24/7, leading to significant waste, as they are often only used during business hours.

The mental model

Think of it as putting your office lights on a timer. The lights automatically turn on at 8 AM and off at 6 PM, saving electricity when no one is there. Similarly, automated shutdown policies ensure you only pay for compute capacity when your teams or processes are actively using it.

How it works

This is implemented using policies based on schedules or inactivity. For schedules, you might set a rule to stop all virtual machines tagged "environment:dev" at 7 PM on weekdays and start them at 8 AM. For inactivity, a policy might monitor CPU or network usage and shut down an instance if it remains below a threshold for a set period. This is often done with cloud-native tools like AWS Lambda and CloudWatch Events, Azure Automation, or GCP Cloud Scheduler.

When to use it

This strategy is best for predictable, non-critical workloads. Three key places are: first, development and testing environments that are only used during business hours; second, scheduled batch processing jobs, like nightly data pipelines or ML model training; and third, individual developer workstations that are often left running after work.

When not to use it

Avoid applying aggressive shutdown policies to critical production services that require 24/7 availability. Be especially cautious with stateful applications; if the application's state is not properly saved to persistent storage before shutdown, you risk data loss or corruption. Always ensure your shutdown scripts handle state gracefully.

One canonical example

A common setup uses AWS Lambda with CloudWatch Events to create a scheduler. A Lambda function runs on a cron schedule (e.g., every evening at 7 PM) to find all EC2 instances with a specific tag, like "Auto-Shutdown:True", and issues a 'stop' command. Another function runs in the morning to start them again. This simple setup can reduce costs for non-production fleets by over 60%.

Interview question

For which scenario would implementing automated cloud resource shutdown policies be most beneficial and appropriate?

  • a.A real-time data streaming service that processes continuous incoming data.
  • b.A critical, stateful production database that must be available 24/7.
  • c.A development environment used by a team exclusively during standard business hours.Correct
  • d.A production API gateway handling all incoming requests for a high-traffic application.
Why?

Automated shutdown is ideal for non-critical workloads like development environments used during specific hours, as it saves costs on idle resources. It is explicitly advised against for critical, 24/7 production services or stateful applications due to potential availability issues or data loss.

Just read this? Test yourself on what you have been reading.

Read the original → mlopscrew.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on cloud — each one lists the topics its interview covers.

See open roles