aws-cdk-lib.AppProps

interface AppProps

LanguageType name
.NETAmazon.CDK.AppProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2#AppProps
Javasoftware.amazon.awscdk.AppProps
Pythonaws_cdk.AppProps
TypeScript (source)aws-cdk-lib » AppProps

Initialization props for apps.

Example

const app = new App({
  defaultStackSynthesizer: AppStagingSynthesizer.defaultResources({
    appId: 'my-app-id',
    deploymentIdentities: DeploymentIdentities.cliCredentials(),
  }),
});

Properties

NameTypeDescription
analyticsReporting?booleanInclude runtime versioning information in the Stacks of this app.
autoSynth?booleanAutomatically call synth() before the program exits.
context?{ [string]: any }Additional context values for the application.
defaultStackSynthesizer?IReusableStackSynthesizerThe stack synthesizer to use by default for all Stacks in the App.
outdir?stringThe output directory into which to emit synthesized artifacts.
policyValidationBeta1?IPolicyValidationPluginBeta1[]Validation plugins to run after synthesis.
postCliContext?{ [string]: any }Additional context values for the application.
stackTraces?booleanInclude construct creation stack trace in the aws:cdk:trace metadata key of all constructs.
treeMetadata?booleanInclude construct tree metadata as part of the Cloud Assembly.

analyticsReporting?

Type: boolean (optional, default: Value of 'aws:cdk:version-reporting' context key)

Include runtime versioning information in the Stacks of this app.


autoSynth?

Type: boolean (optional, default: true if running via CDK CLI (CDK_OUTDIR is set), false otherwise)

Automatically call synth() before the program exits.

If you set this, you don't have to call synth() explicitly. Note that this feature is only available for certain programming languages, and calling synth() is still recommended.


context?

Type: { [string]: any } (optional, default: no additional context)

Additional context values for the application.

Context set by the CLI or the context key in cdk.json has precedence.

Context can be read from any construct using node.getContext(key).


defaultStackSynthesizer?

Type: IReusableStackSynthesizer (optional, default: A DefaultStackSynthesizer with default settings)

The stack synthesizer to use by default for all Stacks in the App.

The Stack Synthesizer controls aspects of synthesis and deployment, like how assets are referenced and what IAM roles to use. For more information, see the README of the main CDK package.


outdir?

Type: string (optional, default: If this value is not set, considers the environment variable CDK_OUTDIR. If CDK_OUTDIR is not defined, uses a temp directory.)

The output directory into which to emit synthesized artifacts.

You should never need to set this value. By default, the value you pass to the CLI's --output flag will be used, and if you change it to a different directory the CLI will fail to pick up the generated Cloud Assembly.

This property is intended for internal and testing use.


policyValidationBeta1?

Type: IPolicyValidationPluginBeta1[] (optional, default: no validation plugins)

Validation plugins to run after synthesis.


postCliContext?

Type: { [string]: any } (optional, default: no additional context)

Additional context values for the application.

Context provided here has precedence over context set by:

  • The CLI via --context
  • The context key in cdk.json
  • The AppProps.context property

This property is recommended over the AppProps.context property since you can make final decision over which context value to take in your app.

Context can be read from any construct using node.getContext(key). Example

// context from the CLI and from `cdk.json` are stored in the
// CDK_CONTEXT env variable
const cliContext = JSON.parse(process.env.CDK_CONTEXT!);

// determine whether to take the context passed in the CLI or not
const determineValue = process.env.PROD ? cliContext.SOMEKEY : 'my-prod-value';
new App({
  postCliContext: {
    SOMEKEY: determineValue,
  },
});

stackTraces?

Type: boolean (optional, default: true stack traces are included unless aws:cdk:disable-stack-trace is set in the context.)

Include construct creation stack trace in the aws:cdk:trace metadata key of all constructs.


treeMetadata?

Type: boolean (optional, default: true)

Include construct tree metadata as part of the Cloud Assembly.