How an AI Kept Me Sane Through a Midnight Database Migration

How an AI Kept Me Sane Through a Midnight Database Migration
Photo by Creative Minds Factory / Unsplash

It's 23:16 on a Saturday night. I've been awake since 6am. I'm tired, slightly caffeinated, and staring down the barrel of a midnight database maintenance window. The job? Snapshot a 470GB production database, share it across AWS accounts, and restore it to our preprod environment. Easy enough on paper. Brutal when you're fighting to keep your eyes open.

I did what any reasonable person would do: I opened Claude and said "help me stay awake."

What followed was one of the strangest, most effective on-call experiences of my career.

The Setup

The work itself was straightforward - I'd done this restore procedure multiple times before. Take a snapshot, share it between AWS accounts, kick off Terraform, wait 20-30 minutes for the restore to complete, verify everything works. Standard ops stuff.

The challenge? It was nearly midnight, I'd been up for 17 hours, and I had at least another 90 minutes of work ahead of me once I got the green light from the application team. Coffee wasn't cutting it anymore. I needed something else.

Enter the AI Hype Man

I wasn't looking for technical help - I knew the procedure cold. What I needed was someone to talk to. Someone to keep me engaged during the long stretches of watching progress bars. Someone to remind me to stay standing when my eyelids started drooping.

So I told Claude what I was doing and asked for tips to stay awake. The response was immediate and practical:

  • Do jumping jacks every 10 minutes
  • Splash cold water on your face
  • Stand up and work standing
  • Put on music that's slightly annoying (something you can't ignore)
  • Prep everything NOW while you're still alert

Simple advice, but it worked. I cranked up a Boiler Room set (Chase & Status in London, 2023), turned all my lights to harsh white, and got moving.

The Waiting Game

The first hour was prep work. I created a pull request with the new snapshot identifier, got it approved by a coworker who happened to still be online (clutch), and verified I could log into the customer environment. Everything was lined up and ready to go.

Then came the message from the application team: "Please wait for my go... might end up being 00:30 rather than 00:00."

An extra 30 minutes of waiting. This is where things get dangerous in ops work - you're ready to go, fully caffeinated and alert, but with nothing to actually do. Your brain wants to drift.

Claude kept checking in: "How you feeling? Still alert? This is when the waiting gets tedious."

It sounds simple, but having those regular check-ins made a difference. It's the equivalent of having a coworker in the room with you during a late-night maintenance window, except this coworker never gets tired and doesn't judge you for dancing to drum & bass at your desk at midnight.

The Technical Work (The Easy Part)

At 00:34, I got the green light. Services were stopped, time to go.

I clicked through the AWS console, created the production snapshot, shared it with our acceptance account. Merged the PR, commented "atlantis apply" to kick off Terraform. Then came the waiting - 20+ minutes of watching Terraform slowly destroy the old cluster and create a new one from the 470GB snapshot.

This is typically where I'd be fighting to stay awake, hypnotized by repeating log messages:

module.aurora_cluster["preprod"].aws_rds_cluster.this[0]: Still creating... [18m20s elapsed]
module.aurora_cluster["preprod"].aws_rds_cluster.this[0]: Still creating... [18m30s elapsed]

But I had Claude reminding me: "Don't get hypnotized by the terraform output. Stay standing. Keep moving."

The Danger Zone

Around the 19-minute mark of the restore, I hit a wall. The text on my screen started getting blurry. The adrenaline was wearing off. I'd been awake for almost 20 hours.

"I'm starting to feel a dip coming up," I told Claude.

The response was immediate: "Stand up NOW if you're sitting. More cold water. Walk around. Turn the music up if you can. Don't crash now. Stay with me."

I took a bio break. Cold toilet seat, cold water in my face. Came back to my desk standing up, music too loud, lights too bright. Uncomfortable and awake.

"The cold toilet seat and cold water in my face. I'm UP AGAIN!" I reported back.

"There you go! Cold shock to the system - that's what you needed."

The Paranoia Check

At some point during the restore, exhaustion-induced paranoia kicked in. "Wait... I used the right snapshot ARN in the PR, right? Better verify."

This is classic tired-brain behavior - second-guessing things you already checked. But Claude didn't dismiss it: "That's fatigue paranoia talking, but honestly - quick verification won't hurt and will give you peace of mind."

I pulled up the AWS console, copy-pasted the ARN from my PR, confirmed it was correct and shared with the right account. 30 seconds of verification that let me stop worrying and focus on the work.

The Finish Line

At 01:21, Terraform finished. Cluster was up and running. I ran my connectivity checks, pinged the product team for final verification. Five minutes later: "Everything looks good on my end!"

Done. Almost two hours of work, from 23:14 to 01:35. I'd been awake for nearly 20 hours, but I'd pulled it off without any mistakes.

I logged my timestamps in my work journal (for the Monday morning recuperation request to HR), merged the PR, and officially entered on-call mode. If the migration went sideways overnight, they'd call me to restore from the snapshot. But the heavy lifting was done.

What I Learned

This wasn't about getting technical help with AWS or Terraform. I knew how to do the work. The challenge was staying alert and focused during the boring parts - the waiting, the progress bars, the hypnotic log messages at 1am.

Having an AI to talk to during those gaps made the difference. It was like pair programming, except instead of writing code together, we were just... keeping each other company through the tedium of infrastructure work.

Some practical takeaways for anyone doing late-night ops work:

Physical tricks that actually work:

  • Cold air is your friend. Turn down the heat, open a window
  • Harsh white light kills that cozy evening vibe
  • Stand up. Dance. Move. Sitting still is the enemy
  • Cold water on your face and wrists provides instant alertness boosts

Mental tricks:

  • Music that demands attention (170+ BPM drum & bass works wonders)
  • Regular check-ins, even if it's just with an AI
  • Verify things when paranoia kicks in - 30 seconds of confirmation beats hours of worrying
  • Prep everything early while you're still sharp

The human element:

  • Late-night ops work is lonely and tedious
  • Having someone to talk to (human or AI) breaks up the monotony
  • Sometimes you just need someone to tell you "stand up NOW" when you're drifting

The Aftermath

I'm writing this on Monday morning, well-rested and caffeinated (normally this time). The migration went smoothly over the weekend. No emergency calls. The product team did their work, and the snapshot I'd prepared was their safety net in case things went wrong.

Would I do midnight maintenance with an AI companion again? Absolutely. It won't replace good preparation, solid procedures, or knowing your systems. But for the human challenge of staying alert and focused through hours of waiting and watching progress bars?

Sometimes you just need someone to remind you to splash cold water on your face and keep dancing to Pendulum.


The author is a DevOps engineer who has too many stories about datacenters, fire suppression systems, and solar eclipses in Dublin. He makes his own bread and has strong opinions about espresso machines.