Measure once, cut twice
Measure once, cut twice
βHas it ever happened to you to mix up terminals and run a command in the wrong place? For example, on production instead of the dev environment. It's only half the trouble when it's not a destructive operation, but what if you deleted a database or a directory, confident you were doing it on staging?
In that case, the only good news is that you'll find out about it very soon π. The folks over in the support department react faster than your fancy monitoring. At that moment all sorts of thoughts race through your head, and you're already mentally planning an unscheduled, indefinite vacation. As luck would have it, there's no quick recovery plan at hand (who thinks about a disaster recovery plan until disaster strikes?). Then you recover from the shock a bit and start fixing your screw-up. You check the state of the backups, hoping they're recent and working. If not, well, you're in trouble.
How do you like that scenario? Long ago I had my share of screw-ups, though not that many. Now I check ten times before performing a destructive operation; what's more, I sometimes first simply shut down the virtual machine or database before deleting it, wait a day or two, and if no one comes asking β then it can be deleted. Because even if you're doing something you're sure of, others may give you incorrect information about how critical a particular VM or DB is. It won't be your fault, but you'll be the one restoring it afterwards. And we like to put a safety net in place wherever possible.
βΆοΈThat said, a safety net isn't always possible, because deleting or changing some component can implicitly affect the operation of others β something you either didn't know about or your train of thought simply didn't reach that far.
So the main rule is: before deleting, check everything, and where possible leave yourself a chance to roll back if something goes off-plan, as happens in large and complex systems.
And one more piece of advice: use clear naming for objects so they don't mislead you about which subsystem they belong to.