Skip to content
v2.273.0

AppProps Struct ​

Initialization props for apps.

Example ​

ts
import { BucketEncryption } from 'aws-cdk-lib/aws-s3';

const app = new App({
  defaultStackSynthesizer: AppStagingSynthesizer.defaultResources({
    appId: 'my-app-id',
    stagingBucketEncryption: BucketEncryption.S3_MANAGED,
    deploymentIdentities: DeploymentIdentities.specifyRoles({
      cloudFormationExecutionRole: BootstrapRole.fromRoleArn('arn:aws:iam::123456789012:role/Execute'),
      deploymentRole: BootstrapRole.fromRoleArn('arn:aws:iam::123456789012:role/Deploy'),
      lookupRole: BootstrapRole.fromRoleArn('arn:aws:iam::123456789012:role/Lookup'),
    }),
  }),
});

Properties ​

analyticsReportingbooleananalytics_reportingboolanalyticsReportingBooleanAnalyticsReportingboolAnalyticsReporting*bool= Value of 'aws:cdk:version-report…#
Include runtime versioning information in the Stacks of this app.
default

Default: Value of 'aws:cdk:version-reporting' context key

autoSynthbooleanauto_synthboolautoSynthBooleanAutoSynthboolAutoSynth*bool= true if running via CDK CLI (`CD…#
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.

default

Default: true if running via CDK CLI (CDK_OUTDIR is set), false otherwise

context{ [key: string]: any }contexttyping.Mapping[str, Any]contextMap<String, Object>ContextIDictionary<string, object>Context*map[string]interface{}= 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).

defaultStackSynthesizerIReusableStackSynthesizerdefault_stack_synthesizerIReusableStackSynthesizerdefaultStackSynthesizerIReusableStackSynthesizerDefaultStackSynthesizerIReusableStackSynthesizerDefaultStackSynthesizerIReusableStackSynthesizer= A `DefaultStackSynthesizer` with…#
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.

default

Default: A DefaultStackSynthesizer with default settings

outdirstringoutdirstroutdirStringOutdirstringOutdir*string= If this value is _not_ set, cons…#
The output directory into which to emit synthesized artifacts.
notes · default

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.

Default: If this value is not set, considers the environment variable CDK_OUTDIR. If CDK_OUTDIR is not defined, uses a temp directory.

performanceReportingbooleanperformance_reportingboolperformanceReportingBooleanPerformanceReportingboolPerformanceReporting*bool= Value of 'aws:cdk:performance-re…#
Produce a performance counter report if supported by the CLI.

The performance report will be produced if the total synthesis time exceeds 10 seconds/stack, unless this property is used to switch the report off altogether (set to false).

default

Default: Value of 'aws:cdk:performance-reporting' context key

policyValidationBeta1IPolicyValidationPluginBeta1[]policy_validation_beta1typing.List[IPolicyValidationPluginBeta1]policyValidationBeta1List<IPolicyValidationPluginBeta1>PolicyValidationBeta1IPolicyValidationPluginBeta1[]PolicyValidationBeta1*[]IPolicyValidationPluginBeta1= no validation pluginsdeprecated#
Use `Validations.of(app).addPlugins()` instead.
postCliContext{ [key: string]: any }post_cli_contexttyping.Mapping[str, Any]postCliContextMap<String, Object>PostCliContextIDictionary<string, object>PostCliContext*map[string]interface{}= no additional context#
Additional context values for the application.
notes · example

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).

ts
// 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,
  },
});
propertyInjectorsIPropertyInjector[]property_injectorstyping.List[IPropertyInjector]propertyInjectorsList<IPropertyInjector>PropertyInjectorsIPropertyInjector[]PropertyInjectors*[]IPropertyInjector= no PropertyInjectors#
A list of IPropertyInjector attached to this App.
stackTracesbooleanstack_tracesboolstackTracesBooleanStackTracesboolStackTraces*bool= true stack traces are included u…#
Include construct creation stack trace in the `aws:cdk:trace` metadata key of all constructs.
default

Default: true stack traces are included unless aws:cdk:disable-stack-trace is set in the context.

treeMetadatabooleantree_metadatabooltreeMetadataBooleanTreeMetadataboolTreeMetadata*bool= true#
Include construct tree metadata as part of the Cloud Assembly.

Used as props by ​