Infrastructure Design Pattern Catalogue

Introduction

This catalogue describes useful approaches for designing infrastructure which is defined as code, and managed like software. Each pattern in the catalogue describes a recurring and useful solution, giving the context in which it may be useful, and some advice on implementation. (Read the full introduction)

Infrastructure Stacks 🔍 (Ready for review)

An Infrastructure Stack is a collection of infrastructure elements that is defined, provisioned, and updated as a unit. The elements of the stack are defined in source code, and may include a combination of compute, networking, and/or storage resources. A stack management tool reads the source code and interacts with an infrastructure platform to ensure the specified resources are provisioned as an instance of the stack. (Read more)

Template Stack Pattern A Template Stack is an infrastructure stack that is designed so that its source code can be used to create and manage multiple, consistent instances. (🔍 Ready for review)
Library Stack Pattern A Library Stack is an infrastructure stack project that is designed to be used as a base to create more specialised stacks. (🔍 Ready for review)
Singleton Stack Antipattern The Singleton Stack antipattern uses a separate copy of the stack source code project for each infrastructure stack instance. (🔍 Ready for review)
Many-headed Stack Antipattern A Many-Headed Stack manages the infrastructure for multiple environments in a single stack project. (🔍 Ready for review)
Stack Code Module Pattern A Stack Code Module is infrastructure code that can be included into one or more infrastructure stack projects. (🔍 Ready for review)

Patterns For Structuring Stacks 🔍 (Ready for review)

A key challenge with infrastructure design is deciding how to size and structure stacks. The infrastructure for a given system may be defined as a single stack, or spread across multiple stacks. Shared code may also be used across stacks. (Read more)

Monolithic Stack Antipattern A Monolithic Stack is an infrastructure stack that includes too many elements, so that it is difficult to work with. (🔍 Ready for review)
Micro Stack Pattern The Micro Stack pattern involves dividing a system into multiple, loosely coupled infrastructure stacks, so that it is easy manage them independently. (🔍 Ready for review)
Single Service Stack Pattern A Single Service Stack defines the infrastructure specific to a single application in its own infrastructure stack. (🔍 Ready for review)
Multi-Service Stack Pattern A Multi-Service Stack hosts multiple applications in a single instance of the infrastructure stack. (🔍 Ready for review)
Cross-Stack Service Pattern Defining the infrastructure to host an application across multiple infrastructure stacks is the Cross Stack Service pattern. This is a variation of the micro stack pattern. (🔍 Ready for review)

Patterns For Configuring Stacks 🔍 (Ready for review)

Defining an infrastructure stack as code enables the creation of multiple instances of the stack. Some aspects of the stack may need to vary for different instances of the stack - at the least, different names, identifiers, and/or tags are needed to distinguish the different instances. There are different techniques for setting configuration for instances of a stack. (Read more)

Commandline Stack Parameters Pattern The simplest way to provide values for a stack instance is to pass the values on the command line. (🔍 Ready for review)
Instance Configuration File Pattern Values can be provided to instances of template stacks by putting them into files, checked into version control. (🔍 Ready for review)
Wrapper Stack Pattern A Wrapper Stack is an infrastructure stack project which is used to import stack code from a module, and pass configuration values for a specific stack instance. This is essentially a mechanism to configure stacks. (🔍 Ready for review)
Pipeline-Defined Parameters When infrastructure code is applied to environments using a Continuous Delivery Pipeline, stack instance values can be defined in pipeline job configuration. Each stage which applies the stack code to a given environment includes configuration values for that environment, which is then passed to the command which applies to the code. (🔍 Ready for review)
Stack Parameter Registry Stack instance configuration values can be stored in a parameter registry. The appropriate set of values can be retrieved from the registry by the stack management tool or stack orchestration tool when applying the code to a stack instance. (🔍 Ready for review)

Patterns For Multiple Stacks 🔍 (Ready for review)

As a system grows, it often makes sense to divide the infrastructure into multiple stacks, in order to avoid a monolithic stack. (Read more)

Shared Infrastructure Stack Pattern A Shared Infrastructure stack includes infrastructure elements that are used by other stacks. (🔍 Ready for review)
Shared Nothing Stack A Shared Nothing infrastructure stack defines everything needed to spin up. Does not use, for example, shared networking constructs. (👷 In progress, not ready for review)

Patterns For Integrating Stacks 👷 (In progress, not ready for review)

Given that one infrastructure stack (a consumer stack) requires infrastructure elements defined in another stack (a provider stack), there needs to be a way for an instance of the consumer stack to find the needed elements from the relevant instance of the provider stack. (Read more)

Stack Orchestration Tools 👷 (In progress, not ready for review)

A stack orchestration tool is a tool, usually written by a team, that is used to run a stack management tool such as Terraform, CloudFormation, etc. These are usually written in order to manage configuration and parameters, and in some cases to marshal stack definition code. (Read more)

Stack Orchestration Tools A stack orchestration tool is a tool, usually written by a team, that is used to run a stack management tool such as Terraform, CloudFormation, etc. These are usually written in order to manage configuration and parameters, and in some cases to marshal stack definition code. (👷 In progress, not ready for review)