Skip to content

7. Cattle, not pets

Infrastructure should be designed with the expectation of failure, such that a failure of any one component would not impact operations. Running instances of infrastructure should be immutable and updated by replacement.

In the vernacular, and especially in DevOps circles, this pattern has been embodied by the rather catchy phrase "Cattle, Not Pets". The analogy was developed by Randy Bias7, who, around 2011-2012, needed to communicate the centrality of the disposability of servers in the context of horizontal and vertical scaling on public cloud platforms.

The central principle here is that "Pets" are indispensable (they are manually built and managed, and are explicitly referenced by name elsewhere in an application); "cattle", by contrast are not. They are defined using automated tooling, and built with the expectation of failure.

As a recommended practice, we encourage designing cloud components that are conceptually "cattle", not "pets". Their creation and instantiation should follow an Infrastructure as Code pattern wherever possible. Applications should avoid dependency on specific instances of infrastructure.