--- name: webiny-infrastructure-extensions description: > Modifying AWS infrastructure using Pulumi handlers and declarative Infra components. Use this skill when the developer wants to customize AWS infrastructure, add Pulumi handlers, configure OpenSearch, VPC, resource tags, regions, custom domains, blue-green deployments, environment-conditional config, or manage production vs development infrastructure modes. Covers CorePulumi.Interface, all declarative components, and . --- # Infrastructure Extensions ## TL;DR Infrastructure extensions modify your AWS infrastructure using Pulumi handlers and declarative `` components in `webiny.config.tsx`. Pulumi handlers implement `CorePulumi.Interface` and are registered via ``. Declarative components configure OpenSearch, VPC, tags, regions, custom domains, blue-green deployments, and environment-specific settings. ## Pulumi Handler Pattern Write custom Pulumi code that runs during infrastructure deployment: ```typescript // extensions/MyCorePulumiHandler.ts import { Ui } from "webiny/infra"; import { CorePulumi } from "webiny/infra/core"; class MyCorePulumiHandlerImpl implements CorePulumi.Interface { constructor(private ui: Ui.Interface) {} execute(app: any) { this.ui.info("Executing MyCorePulumiHandler with environment:", app.env); // Access and modify Pulumi resources here // app.resources gives you access to all provisioned resources } } export default CorePulumi.createImplementation({ implementation: MyCorePulumiHandlerImpl, dependencies: [Ui] }); ``` Register (**YOU MUST include the `.ts` file extension in the `src` prop** — omitting it will cause a build failure): ```tsx ``` ### Use Cases for Pulumi Handlers - Add custom AWS resources (CloudWatch alarms, extra S3 buckets, Lambda functions) - Modify existing resource properties (Lambda memory, timeouts, environment variables) - Add conditional infrastructure based on environment - Integrate with third-party infrastructure providers ## Declarative Infrastructure Components These components go directly in `webiny.config.tsx` -- no separate extension file needed: ### AWS Configuration ```tsx {/* Set the AWS region */} {/* Apply tags to all AWS resources -- multiple calls are merged */} ``` ### Search & Networking OpenSearch, DynamoDB and the S3 bucket belong to the Core app, so they live under `Infra.Core`. The older top-level names (`Infra.OpenSearch`, `Infra.DynamoDb`, `Infra.S3Bucket`) still work and point at the same components. ```tsx { /* Enable/disable OpenSearch */ } ; { /* Enable/disable VPC deployment */ } ; ``` ### Backups Both are on by default for production environments and off for all others. Set `enabled` to override that in either direction. ```tsx { /* DynamoDB point-in-time recovery (primary, audit logs and, with OpenSearch, the ddb-os table) */ } ; { /* S3 versioning on the File Manager bucket */ } ; ``` ### Resource Naming ```tsx { /* Prefix all Pulumi resource names */ } ; { /* Define which environments use production-grade infrastructure */ } ; ``` ### Custom Domains ```tsx ``` ### Blue-Green Deployments ```tsx ``` ## Environment-Conditional Configuration Use `` to apply settings only in specific environments: ```tsx { /* Production only */ } ; { /* Non-production (accepts array) */ } ; ``` ## Project-Level Settings ```tsx { /* Disable telemetry */ } ; { /* Auto-install for CI/CD (skip the installation wizard) */ } { process.env.WEBINY_CLI_AUTO_INSTALL && ( ); } ``` ## All Infrastructure Components Reference | Component | Purpose | | ------------------------------------------------------- | ------------------------------------ | | `` | Set the AWS region | | `` | Tag all AWS resources | | `` | Enable/disable OpenSearch cluster | | `` | Enable/disable VPC deployment | | `` | DynamoDB point-in-time recovery | | `` | S3 versioning on File Manager bucket | | `` | Prefix Pulumi resource names | | `` | Define production-grade environments | | `` | Custom domains for Admin app | | `` | Blue-green deployment configuration | | `` | Conditional config per environment | | `` | Register a custom Pulumi handler | | `` | Enable/disable telemetry | | `` | Auto-install for CI/CD | ## Quick Reference ``` Pulumi import: import { CorePulumi } from "webiny/infra/core"; Ui import: import { Ui } from "webiny/infra"; Interface: CorePulumi.Interface Export: CorePulumi.createImplementation({ implementation, dependencies }) Register: Deploy: yarn webiny deploy core (infrastructure changes) ``` ## Related Skills - `webiny-project-structure` -- Full `webiny.config.tsx` anatomy - `webiny-local-development` -- Deployment commands and environment management - `webiny-full-stack-architect` -- Full-stack extensions that may require custom infrastructure