Deployments and Infrastructure > Extensions > Environment-Specific Config
Environment-Specific Configuration
Learn how to apply different infrastructure configuration per deployment environment.
- how to apply different infrastructure settings per environment using
Infra.Env.Is - how to read the current environment name inside extension logic using
Infra.Env.useEnv
Overview
It’s common to want different infrastructure settings per environment — for example, enabling OpenSearch only in production, or applying different AWS tags per environment. Use Infra.Env.Is to conditionally apply any Infra.* configuration.
Configuration
Infra.Env.Is accepts either a single environment name string or an array of names. Any Infra.* component can be nested inside it.
Reading the Current Environment
Use Infra.Env.useEnv when you need the environment name as a value inside your own extension logic — for example, to build a resource name prefix dynamically:
env.name returns the value passed via --env when running webiny deploy --env <name>.
Redeploying After Changes
After making changes, redeploy by running the webiny deploy command:
Use --env <name> to target a specific environment if needed.