What you’ll learn
  • what are environments
  • how are environments handled in a Webiny project
Just want to deploy?
This article covers the general idea of environments and how they are embedded into a Webiny project. To learn how to deploy your project using Webiny CLI, please visit the Deploy your project guide.

What Are Environments?
anchor

Your project can be deployed into multiple environments.

This means that you can have multiple “copies” of your project up and running at the same time, each having its own name and purpose.

Every project most certainly has an environment called production. This is the environment that represents “the real thing” - the system that’s being used by real users. It’s in your best interest to ensure this system is always online and the code that makes it into this environment is well tested. In order to achieve this, you deploy your project to a number of pre-production environments.

For example, you might have multiple development environments, to which developers can deploy their changes, ready to be tested by the rest of the team. Once the changes have been approved, an additional round of testing can be done in a preview, or more commonly called, staging environment. This is the environment that’s the closest to the production environment in terms of the code, different configurations, cloud infrastructure, and so on.

For best practices on how to organize your environments and other workflows, check out the Workflows section.

Environments in a Webiny Project
anchor

Every project application can be deployed into several different environments. For example, we might have three applications in our project, and for each, we might want to have three different environments: dev, staging, and production.

Environments.Environments.
(click to enlarge)

Note that Webiny does not sync environments across your project applications. Meaning, if you want to deploy your entire project into a specific environment, you need to deploy every application into it. So, in the case of the above project, you would need to deploy all three applications.

Fortunately, Webiny makes it easy to work with different environments, using the Webiny CLI and Pulumi. Be sure to check out the Deploy your project guide to learn how to deploy a Webiny project.
Watch out for extra costs
Deploying multiple project environments into the same AWS account may incur additional cost. Check out the Cloud Infrastructure section for more information.

FAQ
anchor

How Many Different Environments Can a Project Have?
anchor

The answer is: as many as needed. There is no limit on the count of different environments you can deploy.

Depending on the Environment, Can a Different Cloud Infrastructure Be Deployed?
anchor

This can be done. Since the cloud infrastructure is defined using code, nothing prevents you from using a couple of if statements to determine which resources need to be deployed.

Is It Reasonable to Have Different Cloud Infrastructure Deployed Based on the Environment?
anchor

In certain cases, this might be reasonable. For example, you can reduce development costs by not deploying custom VPCs (and related cloud infrastructure resources) for development environments. You only deploy the full set of cloud infrastructure resources into staging and production environments.

Depending on the environment, the API project application is deployed as two different sets of cloud infrastructure resources - development and production. Visit the API Overview - Default VPC key topic to learn more.