Skip to main content


The @winglang/platform-awscdk platform compiles your program for the AWS CDK (CloudFormation).


You will need to install the @winglang/platform-awscdk library in order to use this platform.

$ npm i @winglang/platform-awscdk

This platform requires the environment variable CDK_STACK_NAME to be set to the name of the CDK stack to synthesize.

$ export CDK_STACK_NAME="my-project"
$ wing compile --platform @winglang/platform-awscdk [entrypoint]


The CDK_STACK_NAME environment variable specifies the name of the CDK stack to synthesize.


The output includes both a AWS-CDK configuration file (under target/<entrypoint>.awscdk) and JavaScript bundles that include inflight code that executes on compute platforms such as AWS Lambda.


To deploy your app, you will first need to install the AWS CDK CLI.

If not previously done, you will need to bootstrap your environment (account/region):

$ cdk bootstrap --app target/app.awscdk

And then you can deploy:

$ cdk deploy --app target/app.awscdk


Custom CDK Stack

The App class has a stackFactory property that can be used to customize how the root CDK stack is created.

To use this, create a custom platform like this:

import { App } from "@winglang/platform-awscdk";
import { platform } from "@winglang/sdk";

export class Platform implements platform.IPlatform {
public readonly target = "awscdk";
public newApp?(appProps: any): any {
return new App({
stackFactory: (app: cdk.App, stackName: string) => {
// customize here!
return new cdk.Stack(app, stackName);