AppProps Struct
Initialization props for apps.
Example
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
analyticsReportingoptionalbooleananalytics_reportingoptionalboolanalyticsReportingoptionalBooleanAnalyticsReportingoptionalboolAnalyticsReportingoptional*bool#Default: Value of 'aws:cdk:version-reporting' context key
autoSynthoptionalbooleanauto_synthoptionalboolautoSynthoptionalBooleanAutoSynthoptionalboolAutoSynthoptional*bool#Default: true if running via CDK CLI (CDK_OUTDIR is set), false otherwise
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.
builtinCloudFormationValidationoptionalbooleanbuiltin_cloud_formation_validationoptionalboolbuiltinCloudFormationValidationoptionalBooleanBuiltinCloudFormationValidationoptionalboolBuiltinCloudFormationValidationoptional*bool= true#notes
CDK ships with a CloudFormation template validation plugin that is enabled by default (see CloudFormationValidationPlugin).
To disable the built-in validation, you can do one of these things:
- Set this property to
false. - Run
cdk synth --no-validation. - Set
CDK_VALIDATION=falsein your environment. - Register a custom configured instance of
CloudFormationValidationPluginon theappobject.
confirmValidationPluginsDoNotMutateoptionalbooleanconfirm_validation_plugins_do_not_mutateoptionalboolconfirmValidationPluginsDoNotMutateoptionalBooleanConfirmValidationPluginsDoNotMutateoptionalboolConfirmValidationPluginsDoNotMutateoptional*bool= false#notes
Validation plugins should only read files in the cdk.out directory, and not modify or delete any.
If this is set to true, the CDK will calculate a hash of all files in the assembly directory before running validation plugins and verify that the hashes match afterwards, to ensure no files got deleted or modified. You only need to set this if you do not trust your validation plugins to have been implemented correctly.
contextoptional{ [key: string]: any }contextoptionaltyping.Mapping[str, Any]contextoptionalMap<String, Object>ContextoptionalIDictionary<string, object>Contextoptional*map[string]interface{}#Default: no additional context
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).
defaultStackSynthesizeroptionalIReusableStackSynthesizerdefault_stack_synthesizeroptionalIReusableStackSynthesizerdefaultStackSynthesizeroptionalIReusableStackSynthesizerDefaultStackSynthesizeroptionalIReusableStackSynthesizerDefaultStackSynthesizeroptionalIReusableStackSynthesizer#Default: A DefaultStackSynthesizer with default settings
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: If this value is not set, considers the environment variable CDK_OUTDIR. If CDK_OUTDIR is not defined, uses a temp directory.
notes
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.
performanceReportingoptionalbooleanperformance_reportingoptionalboolperformanceReportingoptionalBooleanPerformanceReportingoptionalboolPerformanceReportingoptional*bool#Default: Value of 'aws:cdk:performance-reporting' context key
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).
policyValidationBeta1optionalIPolicyValidationPluginBeta1[]policy_validation_beta1optionaltyping.List[IPolicyValidationPluginBeta1]policyValidationBeta1optionalList<IPolicyValidationPluginBeta1>PolicyValidationBeta1optionalIPolicyValidationPluginBeta1[]PolicyValidationBeta1optional*[]IPolicyValidationPluginBeta1deprecated#Default: no validation plugins
postCliContextoptional{ [key: string]: any }post_cli_contextoptionaltyping.Mapping[str, Any]postCliContextoptionalMap<String, Object>PostCliContextoptionalIDictionary<string, object>PostCliContextoptional*map[string]interface{}#Default: no additional context
notes · example
Context provided here has precedence over context set by:
- The CLI via --context
- The
contextkey incdk.json - The
AppProps.contextproperty
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).
// 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,
},
});
propertyInjectorsoptionalIPropertyInjector[]property_injectorsoptionaltyping.List[IPropertyInjector]propertyInjectorsoptionalList<IPropertyInjector>PropertyInjectorsoptionalIPropertyInjector[]PropertyInjectorsoptional*[]IPropertyInjector#Default: no PropertyInjectors
stackTracesoptionalbooleanstack_tracesoptionalboolstackTracesoptionalBooleanStackTracesoptionalboolStackTracesoptional*bool#Default: true stack traces are included unless aws:cdk:disable-stack-trace is set in the context.
treeMetadataoptionalbooleantree_metadataoptionalbooltreeMetadataoptionalBooleanTreeMetadataoptionalboolTreeMetadataoptional*bool= true#