# Deployment Stamps: Copy the Whole Stack Instead of Growing One Giant Server Group

> Learn how teams deploy many identical, independent copies of an app, each serving a set of customers, and add a new copy when capacity runs out.

**In short:** Deployment stamps are many identical, independent copies of an app, each serving a set of customers, with a new copy added when capacity runs out.

From "System design", a free course by Venkat R. Murty: https://designervenkat.online/learn/system-design/deployment-stamps

## What You Will Learn

Most apps start on one set of servers with one database. That works well for a while. Then the app grows. One database fills up, one large customer uses so much power that everyone else slows down, or a law says some customers' data must stay in their own region. This lesson teaches Deployment Stamps, a pattern for these moments. A pattern is a reusable answer to a common design problem. In this pattern, you deploy many separate copies of your whole app, and each copy serves a fixed group of tenants. A tenant is one customer or one organization that uses your app, with its own data and users.

By the end, you will know what a stamp is, why teams build them, how a routing layer finds the right stamp for each user, and what the costs and risks are. You will also walk through a worked example and answer two short quiz questions. Read the key words first, because the rest of the lesson uses them.

- **Stamp:** One complete, independent copy of an app and its data, built from the same template as every other copy. Other names for it are service unit, scale unit, or cell.
- **Tenant:** A customer or organization that shares your app, with its own users and data.
- **Multitenant:** An app design where many tenants use the same running system, while their data stays separate.
- **Blast radius:** How much of your system or your customers a single failure can hurt.
- **Routing layer:** A component that looks at each incoming request and decides which stamp should handle it.
- **Infrastructure as code:** Writing the servers, databases, and networks as text files, so a computer can create them the same way every time.
- **Data residency:** A rule that data about certain customers must be stored in a certain country or region.

## What Is a Stamp?

A stamp is a self-contained unit. It holds everything the app needs to serve its tenants: the web servers that take requests, the storage for files, the database that keeps records, and the network that connects them. Because the stamp carries its own database, a stamp is not just a bigger set of web servers. It is a full copy of the stack. The word stamp comes from the idea of pressing the same mold again and again, so each copy looks the same.

Each stamp is limited. It serves a fixed set of tenants or users, and it has a defined capacity limit, such as a maximum number of tenants or devices. When a stamp reaches its limit, you do not stretch it further. You build another stamp and send new tenants there. The Azure guidance describes capacity as a rough measure, such as how many tenants a stamp can hold, and it recommends watching how much of that capacity is used so you can add stamps before you run out.

- **Compute:** The servers or app hosting that run your code. In one stamp, these serve only that stamp's tenants.
- **Storage and database:** The files and records for that stamp's tenants. Data for tenants on other stamps is kept apart from it.
- **Networking:** The connections, addresses, and rules that let the stamp's parts talk to each other and to users.

> **Tip:** Build every stamp from the same template. If stamp 2 is set up by hand and stamp 1 is set up by a script, you will soon have two different systems to debug.

## Why Do Teams Use Stamps?

Teams choose stamps for a few clear reasons. The Azure guidance lists the limits that push a team toward this pattern. A single copy of an app can hit natural limits, such as a cap on how many network connections a service allows. Some parts also get expensive as they grow. Adding more power to one big database can cost far more than adding a second database. Some customers need their data kept apart from others, and some customers use far more resources than the rest. Each of these problems has a matching benefit from stamps.

- **Limit the blast radius:** Stamps run independently. If one stamp fails, tenants on the other stamps keep working. This keeps a single failure from reaching everyone.
- **Scale past one resource's limits:** Instead of pushing one database harder, you add another stamp. Capacity grows in steps, and each step has its own room.
- **Meet data residency rules:** A stamp can be placed in a specific region, so customers who need their data in Europe get a European stamp.
- **Roll out updates in stages:** You can update one stamp, watch it, and then update the next. Customers who want fewer changes can sit on a stamp that updates less often.

The pattern also helps with growth. Because each stamp serves a known number of tenants, planning is simple. You know how many tenants a stamp can take, so you know when to build the next one. Azure's guidance says stamps can make growth almost linear, which means that adding a stamp adds about the same amount of capacity each time.

Stamps are not only for big companies. The guidance notes that some large customers may need their own copy of the system, while smaller customers can share one multitenant copy. That mix is common. A provider might keep most small tenants together and give a few large tenants a stamp of their own.

### How Do Stamps Limit the Blast Radius?

Blast radius is the amount of damage one failure can cause. In a single shared deployment, one bad release, one broken database, or one noisy tenant can affect every customer at once. With stamps, the damage stops at the edge of one stamp. A bad release sent to stamp 2 does not reach stamp 1, because stamp 1 has its own servers and its own data. The Azure pattern page says stamps run independently, but it also warns that stamps are not inherently redundant across regions.

Stamps also limit how far a security problem can travel. Isolation is a design choice, so you must build the separation on purpose.

## What Is the Routing Layer?

Stamps create one new problem. If there are five copies of the app, a user's request must reach the right copy. The routing layer solves this. It sits in front of all stamps, reads each request, and works out which stamp owns the tenant. The routing layer keeps a mapping, a table that links each tenant to one stamp. Azure's guidance says that routing to the correct stamp can need an extra component that resolves tenants to stamps, and that this component might also need to be highly available.

1. **Identify the tenant:** The router reads something in the request, such as a company subdomain, a login token, or a tenant ID, to know who is asking.
2. **Read the mapping:** The router looks up which stamp holds that tenant. The mapping must be kept up to date, because it is the only way the router knows where data lives.
3. **Forward the request:** The router sends the request to that stamp's entry point. The user does not need to know that several stamps exist.
4. **Watch the capacity:** The router's owners track how full each stamp is. When a stamp is nearly full, new tenants are placed on a new stamp.

Routing is also what makes data residency work. If a European customer's mapping points to a stamp in Europe, the router keeps that customer's traffic on that stamp. The routing layer is the piece that turns many separate copies into one product that users can reach from one address.

## Worked Example: A Board App With Three Stamps

Here is an example of the pattern in use. The product is a made-up project-board app, similar in spirit to a Trello-style tool where teams keep tasks on boards. The example is for learning. It is not a description of how any real company builds its app. The company starts with one stamp in the US, and it adds two more as its customers grow. The steps below show how the stamps are set up and what happens during an outage.

1. **Start with one stamp:** Stamp US-1 has web servers and one database. Every customer uses it, and the team is nervous about how much it can hold.
2. **Notice the two problems:** A large customer runs heavy reports that slow the database for everyone. Also, several European customers need their data kept in Europe, which US-1 cannot provide.
3. **Write the template:** The team describes one stamp as infrastructure as code. The file lists the web servers, the database, the storage, and the network, so any new stamp is built the same way.
4. **Build two more stamps:** The team creates EU-1 in a European region and US-2 in a US region from the same template. Each has its own web servers and its own database.
5. **Add the global router:** A router in front of all stamps keeps a mapping. Each customer is listed with one stamp. When a user logs in, the router sends the login to that customer's stamp.
6. **Handle an outage in US-1:** Suppose US-1 goes down. Customers on US-1 cannot use the app until it recovers or their data is moved. Customers on EU-1 and US-2 keep working, because those stamps are separate and do not depend on US-1.

The example also shows the cost of the pattern. The team now runs three databases and three sets of servers instead of one. The team must also remember that the outage was limited, not avoided. The Azure guidance warns that stamps are not automatically spread across regions. If a region goes down, the tenants on that region's stamps lose access until the region recovers or the team moves them.

> **Tip:** When you draw a system with stamps, label each stamp with its region and the tenants it serves. A simple diagram like this makes it clear what fails together and what does not.

## What Trade-offs Should You Weigh?

Stamps solve real problems, but they make some work harder. Read these trade-offs before you choose the pattern. The Azure guidance is clear that deploying many copies of the same parts is complex, and that good automation practices are needed to keep them working.

- **Cost:** Every stamp is a full copy of the infrastructure, so costs rise quickly. Azure's guidance says the pattern substantially increases the cost of running your solution, so a team should check that prices cover that extra spend.
- **Moving tenants:** Each stamp runs on its own, so moving a tenant from one stamp to another is hard. The app needs custom logic to copy a tenant's data over and remove it from the old stamp.
- **Reporting across stamps:** When data is split across stamps, counting all customers takes more work. You may need to ask each stamp and combine the answers, or send every stamp's data into one central store for reports.
- **Monitoring:** The more stamps you have, the harder it is to see the health of the whole system. Azure recommends collecting metrics, logs, and alerts from every stamp into one place, so unhealthy stamps are easy to find.

Two more points matter. First, a stamp can become a hidden fork. If one stamp gets a fix that others do not, the copies drift apart. Second, some parts are shared by all tenants, such as a single-page front end. Those parts can be deployed once and copied to users around the world with a content delivery service, rather than rebuilt inside each stamp.

Finally, Azure's guidance recommends that you deploy at least two stamps. If you run only one, it is easy to write code that assumes there is only one copy. That code breaks the first time you add a second stamp.

### Keeping Stamps Identical

The main risk of stamps is drift. Drift happens when two stamps that should match slowly become different, usually because someone changed one by hand. Drift makes bugs hard to reproduce, because the same release behaves differently on different stamps. The fix is to describe every stamp in code, deploy it through an automated pipeline, and repeat the same steps each time. Azure's guidance names tools such as Bicep and Terraform for this, and it says the deployment of each stamp should be predictable and repeatable.

Updates need the same discipline. Teams also need to know which version each tenant is running and which version each tenant may move to. Without that record, a team cannot tell whether a fix reached the customers who asked for it.

> **Tip:** Before you add a new stamp, check that a script can create it from scratch with no manual steps. If it cannot, the next stamp will be slow to build and likely to differ from the rest.

## A Small Routing Sample

The routing layer in a real product is a web service with a database behind it. This small sample shows the core idea with a plain dictionary. A dictionary is a table of key and value pairs. Each tenant name is a key, and the stamp that holds that tenant is the value. A tenant that is not in the table falls back to a default stamp. The sample only prints results, so it always gives the same output.

```python
STAMPS = {
    "acme": "EU-1",
    "globex": "US-1",
    "initech": "US-2",
}

def route(tenant):
    return STAMPS.get(tenant, "US-1")

for t in ["acme", "globex", "initech", "umbrella"]:
    print(t, "->", route(t))

```

Output:

```text
acme -> EU-1
globex -> US-1
initech -> US-2
umbrella -> US-1

```

Read the output carefully. The tenant umbrella is not in the table, so the router uses the default. In a real system, a default like this can hide mistakes, so many teams prefer to reject unknown tenants instead. The key idea is that the router only needs the mapping. It does not need to know anything about what each stamp does inside.

## Check Your Understanding

Try these two scenarios. Each one needs the idea from this lesson to answer. Pick the option you think is best, then read the reason.

**Quick check:** A project app runs on one shared database. One large customer runs heavy jobs that slow everyone down. The company also must keep its EU customers' data inside Europe. Which change best fits these needs?

A. Add more read copies of the shared database and ask the large customer to run jobs at night.
B. Place the large customer and the EU customers on their own stamps, and add a routing layer that maps each tenant to its stamp.
C. Move the whole app to one faster server in the US so that every customer gets the same speed.

**Answer:** B. Separate stamps keep the heavy customer's load away from others and let the EU stamp sit in Europe. The routing layer is the new piece that sends each login to the right stamp. The other options keep one shared system, so the problems remain.

**Quick check:** A team runs two stamps, and both are at their tenant limit. A new customer in Canada wants its data stored in Canada. What should the team do?

A. Raise the tenant limit on the existing stamps so the new customer fits.
B. Create a new stamp from the same template in a Canadian region, then map the new customer to it in the routing layer.
C. Copy one stamp's database by hand to a Canadian server and keep the app running only on the old stamps.

**Answer:** B. A stamp has a fixed capacity, so the answer is a new stamp, built from the same template so it matches the others. The routing layer then points the customer to the Canadian stamp. Raising the limit breaks the capacity plan, and a hand-made copy causes drift.

## Key Takeaways

A deployment stamp is a complete, independent copy of an app, built from one template and serving a fixed set of tenants. You grow the system by adding stamps instead of making one copy bigger. Stamps reduce blast radius, help with data residency, let you roll out updates in stages, and avoid the limits of one shared database. The price is real: more cost, harder moves between stamps, harder reporting, and more monitoring. A routing layer must map each tenant to a stamp, and automated infrastructure as code keeps the stamps identical. Use stamps when those benefits outweigh the extra work, and start with at least two.

## Sources

- [Deployment Stamps pattern, Azure Architecture Center (Microsoft Learn)](https://learn.microsoft.com/en-us/azure/architecture/patterns/deployment-stamp)
- [Architectural approaches for a multitenant solution, Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/guide/multitenant/approaches/overview)
- [Architectural approaches for the deployment and configuration of multitenant solutions, Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/guide/multitenant/approaches/deployment-configuration)
- [Considerations for updating a multitenant solution, Azure Architecture Center (source file on GitHub)](https://github.com/microsoftdocs/architecture-center/blob/main/docs/guide/multitenant/considerations/updates.md)
- [Move an IoT Hub-based solution to a production environment, Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/example-scenario/iot/iot-move-to-production)
- [AKS baseline for multiregion clusters, Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/containers/aks-multi-region/aks-multi-cluster)
- [Hub-and-spoke network topology, Azure Virtual Network design guide](https://learn.microsoft.com/en-us/azure/networking/design-guide/hub-spoke)
