DEV Community

Discussion on: 7 reasons why Serverless encourages useful engineering practices

Collapse
 
thomasstep profile image
Thomas Step

There is great merit in treating your servers like cattle rather than pets.

I'm sure you meant this, but I would take this a step further and say that infrastructure (not only compute resources) as a whole should be treated as cattle rather than pets.

One area in particular that I try to treat like cattle is naming. I like to make names for secrets, Lambda functions, or even CloudFormation stack names configurable wherever they are referenced. If I ever need to swap to a new secret, Lambda, or CloudFormation stack, I only need to reconfigure whatever is referencing it instead of tear the original down and rebuild.

A big example are secrets. Something like this-is-my-special-secret seems smart until that secret needs to be deleted for some reason and we're stuck in the Secrets Manager deletion period of 7 days. If that secret's name was generated and fed into a Lambda function that references it by environment variable, then we only need to reconfigure a new secret name to the environment variable to change the reference.

TL;DR: Naming is tough. Use generated strings so there's no overlap or special treatment for specific names.