Nightly DigitalOcean Droplet snapshots with auto-cleanup

By General Input

Back up your DigitalOcean servers every night, automatically delete snapshots past your retention window, and get a Slack recap of exactly what changed.

Integrations

  • DigitalOcean
  • Slack Bot

Type

Deterministic Code

Categories

  • Engineering
  • Operations

Every night at 2:00am, snapshot my tagged DigitalOcean Droplets, prune old snapshots beyond a retention window, and post a summary to Slack. Use a cron trigger set to run once nightly at 02:00.

Expose these settings at the top of the workflow so they are easy to change: the Droplet tag to back up (default "backup"), the retention count (default: keep the 7 most recent snapshots per Droplet and delete the rest), the snapshot name date format (default YYYY-MM-DD), and the Slack channel to post the summary to.

Step 1 - find the Droplets. Call DigitalOcean's List All Droplets operation filtered by the configured backup tag to get the set of Droplets to snapshot. If none match the tag, skip straight to the Slack step and report that nothing was tagged for backup.

Step 2 - take snapshots. For each Droplet, call Initiate a Droplet Action with type "snapshot" and a name built from the Droplet name plus the current date in the configured date format (for example "web-01-2026-07-17"). Alternatively, use Act on Tagged Droplets to snapshot the whole tag in one bulk call. Remember that DigitalOcean Droplet actions are asynchronous: each call returns an action object with an id and a status. Collect every returned action id.

Step 3 - wait for completion. Poll Retrieve a Droplet Action for each action id until its status is "completed" or "errored", waiting a few seconds between polls and capping the total wait so the workflow cannot hang forever. Record which Droplets completed successfully and which returned an error.

Step 4 - prune old snapshots. After the new snapshots exist, list the snapshots for each Droplet with List Snapshots for a Droplet (or use List All Snapshots for the whole account and group them by Droplet). Sort each Droplet's snapshots newest first, keep the number set by the retention count, and call Delete a Snapshot for every snapshot beyond that window. Track which snapshot names or ids were deleted per Droplet.

Step 5 - confirm in Slack. Finish by using the Send a Message action (posting as the Slack bot) to the configured channel with a summary: list which Droplets were snapshotted and which old snapshots were deleted per Droplet. If any snapshot action returned status "errored", any poll timed out, or any delete call failed, add a clearly marked warning line at the top naming the affected Droplets so the failure is not missed.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seatsPause marketing emails to escalated customers, then restore them