Skip to content
  • Independent cloud account marketplace
  • Options and USD prices shown before checkout
  • Support available before and after ordering
Developer Workflows

Building Staging and Test Environments in the Cloud

How to build a staging environment on Linode, UpCloud, or AWS that matches production, isolate it with separate accounts or networks, handle test data safely, and keep non production cost under control.

A staging environment is a copy of production that exists so mistakes happen there first. It is where a release is deployed before customers see it, where load tests run without touching real traffic, and where a new database migration is rehearsed. Building one in the cloud is cheaper than it used to be because servers on Linode, UpCloud, and AWS are billed by the hour and can be created from code. This guide covers how close to production a staging environment needs to be, how to isolate it, what to do about data, and how to keep it from quietly doubling the cloud bill.

How close to production does staging need to be?

The value of staging comes from its similarity to production. Same operating system image, same runtime version, same reverse proxy configuration, same environment variables with different values. Differences that are safe to accept are scale and redundancy: one application server instead of four, one database node instead of a replica set, a smaller instance size. Differences that are not safe are a different database engine version, a different TLS setup, or a different network layout, because those are exactly where production only bugs live.

Write the environment down as code so the similarity is enforced rather than remembered. A Terraform configuration with a variable for environment name and a variable for instance size produces staging and production from the same files. The Terraform basics guide covers that setup.

Isolating staging from production

The strongest isolation is a separate cloud account, project, or subscription. On AWS that means a second account inside an AWS Organization, with its own IAM users and roles, its own service quotas, and its own bill. A credential leak or a runaway script in staging cannot reach production resources. On Linode, teams either open a second account or use a single account with user grants that limit which Linodes a person can manage, plus tags to mark each environment. UpCloud supports sub accounts under a main account, which is a practical middle ground: one billing relationship, separate logins with restricted permissions.

The weaker but simpler option is one account with separate networks. A second VPC on AWS, a second VLAN on Linode, or a separate SDN private network on UpCloud keeps traffic apart, and a naming convention keeps humans from confusing the two. This works for a small team as long as the IAM policies or user grants stop staging automation from touching production resources.

Approach Isolation strength Overhead Fits best when
Separate account, project, or subscription Strongest: separate identities, quotas, and billing More accounts to manage, cross account access to configure Production carries real customer data or payment flows
Same account, separate network and IAM scope Moderate: network isolation, shared identity boundary Low, relies on disciplined policies and naming Small teams with one or two services
Same account, same network, different hostnames Weak: only naming separates the two Minimal Personal projects and prototypes only

What to do about data

Staging needs realistic data and must not hold real customer data. Copying the production database into staging is the most common shortcut and the most common privacy problem: staging usually has weaker access controls, more people with logins, and less logging, so it becomes the easiest place to read personal information. The safer options are synthetic data generated by a script, or a production snapshot passed through an anonymisation step that replaces names, email addresses, phone numbers, and payment tokens before it is restored anywhere else.

Automate the refresh. A weekly job that restores an anonymised snapshot keeps staging close enough to production shape for migrations to be meaningful, and it means nobody has to remember to do it. On AWS, RDS snapshots can be copied and restored into the staging account; on Linode and UpCloud, a managed database backup or a dump and restore into a staging instance does the same job. Point outbound email at a capture service in staging so test runs never send messages to real addresses.

Ephemeral environments per branch

A single shared staging environment becomes a queue once several people are shipping at once. The alternative is an environment per pull request that is created when the branch opens and destroyed when it merges. This is where hourly billing and infrastructure as code pay off: the pipeline runs apply with the branch name as the environment variable, posts the resulting URL on the pull request, and runs destroy on close.

Keep ephemeral environments small. A single Linode or UpCloud server running the application and a lightweight database in a container is enough for functional review; the shared staging environment remains the place for load tests and migration rehearsals. Set a time limit so that a forgotten branch environment is destroyed after a few days whether or not the pull request is closed, and tag every resource with the branch name so orphaned servers can be found and removed.

Controlling the cost of non production

  • Schedule a shutdown. Stop staging servers outside working hours where the provider stops billing compute for stopped instances, and note that Linode and UpCloud bill a powered off server at the same rate as a running one, so there deleting and recreating from code is the saving.
  • Use smaller instance sizes than production and scale up only for a load test.
  • Delete snapshots and volumes left behind by destroyed environments; storage outlives the servers it belonged to.
  • Set a budget alert on the staging account so growth is noticed the month it happens, not at renewal.
  • Review quotas before a big test. A staging account that starts with a low instance or Droplet limit will fail a scale test for reasons that have nothing to do with the code.
  • Keep a monthly list of every non production resource and ask who still needs each one.

Read the guide to cloud service quotas before a load test, since a fresh account’s limits are usually lower than production’s.

Where to go next

Staging is where an extra account earns its keep. The marketplace lists Linode accounts and UpCloud accounts for hourly billed VPS environments, and AWS accounts for teams that need staging to mirror an AWS production stack, with each variant’s label stated on its page.

To wire staging into a release process, continue with CI/CD pipelines that deploy to the cloud. For the checklist that applies to any new server, staging included, see deploying your first cloud server. The Cloud Library hub has the full developer workflow series.

More from the Cloud Library

Telegram