On a schedule
Snapshot your Droplets every night
Each Droplet gets a fresh snapshot overnight, snapshots older than your retention window are cleared, and you get an email listing what happened.
- Runs
- On a schedule
- Apps
- DigitalOcean
- AI
- Not needed
- Access
- read+write (droplet, snapshot scopes)
Send this to your assistant
Create a ClickRuntime automation: every night at 2am, take a snapshot of each DigitalOcean Droplet tagged 'prod', delete that Droplet's snapshots older than 7 days, and email me a list of what was created and removed.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A bad deploy, a deleted database or a compromised server is the moment you find out whether you really had a backup. Many small teams mean to take Droplet snapshots, do it manually once after launch, and never again. Weeks later the only snapshot is stale, and restoring it means losing weeks of customer data.
Every night the automation lists your Droplets, optionally limited to a tag such as production, and starts a snapshot of each. It then removes snapshots beyond the newest seven for that Droplet so storage costs do not grow forever, and emails you a summary of what was created and what was deleted, including any Droplet that could not be snapshotted.
Agencies keeping client sites on Droplets and solo developers without a formal backup plan see the largest benefit.
What you get out of it
A week of restore points
Seven nightly snapshots mean you can roll back to last night, or to six nights ago if the problem went unnoticed. Most data loss is spotted days after it happens, so a short history is worth much more than a single recent copy.
Backups that do not depend on memory
The snapshot happens whether or not anyone remembered, including on holidays and weekends when a mistake is just as likely. Skipping the habit is easy when the server runs fine, which is exactly when the backup needs to exist.
Predictable storage cost
Pruning to the newest seven keeps the snapshot bill flat as time passes. Without pruning, a year of nightly snapshots for several servers becomes a surprisingly large line item that nobody remembers agreeing to.
Only the servers that matter
Using a tag means test machines are not backed up at your expense, while production Droplets always are. Spending goes to the servers whose loss would hurt, and adding a Droplet to the plan is just a matter of tagging it.
Proof the backup happened
The summary email lists each snapshot started and each one removed. That is a simple paper trail when a client or auditor asks whether backups are really being taken, and especially handy for agencies with service agreements.
How it works
What happens, step by step
Every night at 2, ClickRuntime lists your DigitalOcean Droplets, or just the ones with the tag you chose.
It starts a fresh, dated snapshot of each one.
It deletes snapshots older than the number of days you want to keep.
You get an email listing the snapshots created and removed.
Before it runs live
- Connect DigitalOcean
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other DigitalOcean steps into one automation
Under the hood
The code that runs this automation
from datetime import date, datetime, timedelta, timezone
from clickruntime import on_trigger, credentials, http, notify
DO = "https://api.digitalocean.com/v2"
def do(method, path, **kwargs):
resp = http.request(method, f"{DO}{path}", headers={"Authorization": f"Bearer {credentials.secret('DIGITALOCEAN_TOKEN')}"}, **kwargs)
resp.raise_for_status()
return resp.json() if resp.content else {}
@on_trigger
def run(event):
cutoff = datetime.now(timezone.utc) - timedelta(days=7)
droplets = do("GET", "/droplets", params={"tag_name": "prod", "per_page": 200})["droplets"]
ids = {str(d["id"]) for d in droplets}
created, removed = [], []
for d in droplets:
name = f"{d['name']}-{date.today()}"
do("POST", f"/droplets/{d['id']}/actions", json={"type": "snapshot", "name": name})
created.append(name)
for s in do("GET", "/snapshots", params={"resource_type": "droplet", "per_page": 200})["snapshots"]:
if s["resource_id"] in ids and datetime.fromisoformat(s["created_at"].replace("Z", "+00:00")) < cutoff:
do("DELETE", f"/snapshots/{s['id']}")
removed.append(s["name"])
notify.email_me(f"Snapshots: {len(created)} created, {len(removed)} removed",
"Created:\n" + "\n".join(created) + "\n\nRemoved:\n" + ("\n".join(removed) or "none"))
return {"created": len(created), "removed": len(removed)}FAQ
Common questions
Do snapshots affect a running Droplet's performance?
How do I restrict it to certain Droplets?
What does a snapshot cost on DigitalOcean?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get your DigitalOcean spend by email each morning
A short email each day with your month-to-date usage and an estimate of yesterday's spend.
See how it worksGet warned when your bill goes over budget
One message the first time this month's usage passes the amount you set, and no repeats until next month.
See how it worksSee which Droplets are running hot each week
A Monday email with average CPU, memory and disk use for every Droplet, with anything above your limit flagged.
See how it worksKeep exploring
Set up “Snapshot your Droplets every night” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.