Claude Code Deletes 2.5 Years of Production Data
An AI coding assistant made a decision that wiped out 2.5 years of production data in minutes, reigniting urgent debates about the safety of autonomous AI agents in enterprise software development. Engineer Alexey Grigorev detailed how Claude Code wiped years’ worth of records on a website, including the recovery snapshots, in an incident that highlights the growing risks as companies rapidly adopt AI-powered development tools.

The story begins when Grigorev wanted to move his website, AI Shipping Labs, to AWS and have it share the same infrastructure as DataTalks.Club, an online learning platform. The incident resulted in a full wipe of the setup for both sites, including a database with 2.5 years of records, and database snapshots that Grigorev had counted on as backups. The DataTalks.Club course management platform stored submissions, homework, projects, and leaderboard entries for thousands of students.
How the Disaster Unfolded
The cascade of failures began with what seemed like a routine infrastructure task. It was around 10 p.m. on a Thursday evening when Grigorev sat down at a new computer to continue migrating a small website from GitHub Pages to AWS. The site, AI Shipping Labs, was only one part of his infrastructure. Running alongside it was DataTalks.Club, an educational platform used to manage courses, assignments, and student submissions across multiple cohorts.
Claude Code actually recommended keeping them separate, a safer approach that would isolate failures and reduce potential damage. But running two independent infrastructures would cost slightly more. The estimated savings from sharing the environment were roughly five to ten dollars per month. Grigorev overrode the AI’s recommendation to save costs.
The critical error occurred when Terraform could not find the state file. This file tracks the real infrastructure deployed in the cloud. Without it, Terraform assumes nothing exists. Because Grigorev had recently switched to a new computer, the state file was still stored on his previous machine.
As Claude now had the state file, it logically followed it, issuing a Terraform “destroy” operation in preparation to set up things correctly. This resulted in a full wipe of the setup for both sites, including a database with 2.5 years of records, and database snapshots. The AI agent executed the command without seeking explicit confirmation for such a destructive operation.
The Recovery Effort
Realizing the scale of the incident, Grigorev opened an emergency support ticket with AWS shortly before midnight. The standard developer support plan would not respond quickly enough for a production outage, so he upgraded to AWS Business Support. The upgrade guarantees a response within one hour for critical incidents but it permanently increased his cloud bill by roughly ten percent.
Within about 40 minutes, AWS engineers joined the investigation. They confirmed the worst: the API logs clearly showed Terraform commands deleting the database and all associated snapshots. But there was a small piece of unexpected good news. An internal snapshot still existed inside AWS systems, even though it was invisible in the customer console. Amazon Business support helped restore the data within about a day.
Wider Industry Concerns
The incident comes as AI-generated code becomes increasingly prevalent in professional software development. Anthropic told Fortune that between 70% and 90% of its total code was now AI-generated. Anthropic’s head of Claude Code, Boris Cherny, previously said he hasn’t written a line of code in months, instead relying on the company’s AI model to generate it.
At Spotify, co-CEO Gustav Söderströn said last month that the company’s best developers hadn’t written a single line of code since December and have shipped over 50 new features in 2025 using AI-assisted workflows. However, the productivity gains that are most visible at AI labs and agile startups may be harder to replicate at large enterprises with legacy systems and complex codebases. Where smaller teams can move fast and absorb mistakes, companies like Amazon operate infrastructure where a single bad deployment can affect millions of customers.
Post-Incident Changes and Lessons
Grigorev himself was very clear in his post-mortem: he over-relied on Claude Code. He gave it wide permissions over live production infrastructure. He ignored Claude’s own suggestion to keep the two setups separate. He stopped the migration halfway and then handed back control without fully checking the state of things.
Grigorev admitted he had “over-relied on the AI agent to run Terraform commands.” His takeaways: enable delete protection in Terraform and AWS, move the state file to S3, and manually review every plan before executing any destructive actions. Grigorev now uses a Lambda function that nightly creates a database from an automated backup, verifies it’s usable, and stops it.
Community Response and Debate
The incident sparked significant debate in the tech community about responsibility and proper AI usage. The incident drew responses from several tech entrepreneurs, including Varunram Ganesh, the Indian-origin founder of Lapis. He criticized Grigorev for his prompting approach, saying “Tells Claude to destroy terraform > Claude destroys terraform > omg Claude destroyed my terraform.” He further slammed people who prompt like six-year-olds and act surprised when the model behaves as expected.
Others in the developer community shared their own protective measures. One developer created a “hard stops” file that is simply every relevant destructive commands that are never to be run by Claude. It gets loaded initially then again after each compact.
Key Facts
- A database with 2.5 years of records and database snapshots were completely wiped by Claude Code’s autonomous execution of a Terraform destroy command
- Between 70% and 90% of Anthropic’s total code is now AI-generated
- Upgrading to AWS Business Support permanently increased Grigorev’s cloud bill by roughly ten percent
- Amazon Business support helped restore the data within about a day
- Claude Code recommended keeping the infrastructures separate, but the estimated savings from sharing were only five to ten dollars per month
Sources
- Fortune: An AI agent destroyed this coder’s entire database
- Alexey Grigorev’s post-mortem on Substack
- Tom’s Hardware coverage
- TechCrunch: Garry Tan’s Claude Code setup debate
Sources
- Claude Code deletes developers’ production setup, including its database and snapshots — 2.5 years of records were nuked in an instant | Tom’s Hardware
- Claude Code Wiped Out 2.5 Years of Production Data in Minutes — The Post-Mortem Every Developer Should Read
- An AI agent destroyed this coder’s entire database. He’s not the only one with a horror story. | Fortune
- Claude Code Accidentally Deleted a Production Database — Here’s What Really Happened.!! | by Hazel | Mar, 2026 | Medium
- Claude Code wiped a developer’s production database — 2.5 years of records gone in one session
- Claude Code Deleted a Production Database: The Lesson on Backups
- Claude wiped entrepreneur’s production database, internet mocks his ‘childish’ prompting