New to Kestra?
Use blueprints to kickstart your first workflows.
Automate blue-green DNS cutovers on DigitalOcean with Kestra. Remove stale A records, create a verified low-TTL replacement, and alert Slack either way.
Make switching production traffic between environments a one-click, audited operation instead of a nervous console edit. This blueprint performs a blue-green DNS cutover on a DigitalOcean-managed zone: it lists the zone, deletes every existing A record for the target hostname (including accidental duplicates), creates a fresh record pointing at the new environment with a 300 second TTL, reads the record back from the API to verify what DigitalOcean actually serves, and posts the verified result to Slack. If anything fails midway, a dedicated alert tells the team the zone may be half-applied and needs eyes now.
list_records (io.kestra.plugin.digitalocean.domain.record.List) fetches all records in the zone with fetchType: FETCH.remove_stale_records (io.kestra.plugin.core.flow.ForEach) iterates the records; inside, match_record (io.kestra.plugin.core.flow.If) selects only rows where type is A and name equals the record_name input, and delete_record (domain.record.Delete) removes each match by ID. Deleting per record means a zone with duplicate A records, a common leftover from manual edits, still cuts over cleanly.create_record (domain.record.Create) writes the new A record with ttl: 300, so the next cutover or an emergency rollback propagates within minutes.verify_record (domain.record.Get) reads the record back by the ID returned from the create call; the Slack message quotes these verified values rather than the flow's inputs.notify announces success; the errors block sends an urgent alert explaining that the old record may already be gone.DNS cutovers are a sequence with failure modes, not a single call: find the current records, remove them, write the replacement, and prove it took effect. Done by hand, the dangerous window between delete and create is unbounded and unlogged. Kestra executes the sequence in seconds, records every step with timestamps in the execution history, alerts the moment the sequence breaks mid-flight, and turns rollback into re-running the same flow with the previous IP as input.
DIGITALOCEAN_TOKEN: DigitalOcean personal access token.SLACK_WEBHOOK_URL: Slack incoming webhook URL.io.kestra.plugin.core.http.Request against the target IP before the cutover, refusing to switch traffic to an unhealthy environment.type == 'AAAA' and creating a second record.list_records output as a flow output, giving the rollback runbook the exact value to re-apply.io.kestra.plugin.digitalocean.loadbalancer.Update when switching between load balancers instead of single droplets.