Cloud Infrastructure > Extensions > Pulumi Extensions
Pulumi Extensions
Learn how to modify and extend Webiny's cloud infrastructure using Pulumi extension files.
- how to modify existing cloud infrastructure resources using Pulumi extensions
- how to add new resources to the Core, API, and Admin stacks
Overview
For infrastructure changes that go beyond the declarative Infra.* components — modifying Lambda memory, adjusting IAM roles, adding custom resources — you use a Pulumi extension file.
A Pulumi extension is a TypeScript file that receives the Pulumi context for a specific stack and can modify or add resources directly. You register it in webiny.config.tsx using Infra.Core.Pulumi, Infra.Api.Pulumi, or Infra.Admin.Pulumi.
Registering a Pulumi Extension
Each component targets a specific stack:
Infra.Core.Pulumi— Core stack (DynamoDB, S3, OpenSearch, Cognito)Infra.Api.Pulumi— API stack (GraphQL Lambda functions)Infra.Admin.Pulumi— Admin stack (CloudFront, S3 static hosting)
Examples
Modifying an Existing Resource
Enable S3 object versioning on the File Manager bucket (Core stack):
Increasing Lambda Memory Size
Increase the memory of the GraphQL Lambda function (API stack):
Adding an IAM Policy
Attach a custom IAM policy to the GraphQL Lambda role to allow sending email via Amazon SES:
Adjusting CloudFront Distribution Configuration
The following example adjusts the minimum TLS version for the API CloudFront distribution:
Retrieving the Deployment Environment
The app parameter exposes the environment name, which you can use to apply conditional logic:
Checking if the Environment Is Production
Use env.isProduction to check whether the current environment is a production environment. This is calculated based on the list of production environments defined via Infra.ProductionEnvironments:
Redeploying After Changes
After modifying a Pulumi extension, redeploy the affected stack by running the webiny deploy command:
Use --env <name> to target a specific environment if needed. Only redeploy the stack that was changed.