AppProps

class aws_cdk.AppProps(*, analytics_reporting=None, auto_synth=None, context=None, default_stack_synthesizer=None, outdir=None, policy_validation_beta1=None, post_cli_context=None, stack_traces=None, tree_metadata=None)

Bases: object

Initialization props for apps.

Parameters:
  • analytics_reporting (Optional[bool]) – Include runtime versioning information in the Stacks of this app. Default: Value of ‘aws:cdk:version-reporting’ context key

  • auto_synth (Optional[bool]) – 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: true if running via CDK CLI (CDK_OUTDIR is set), false otherwise

  • context (Optional[Mapping[str, Any]]) – 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). Default: - no additional context

  • default_stack_synthesizer (Optional[IReusableStackSynthesizer]) – 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: - A DefaultStackSynthesizer with default settings

  • outdir (Optional[str]) – 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. Default: - If this value is not set, considers the environment variable CDK_OUTDIR. If CDK_OUTDIR is not defined, uses a temp directory.

  • policy_validation_beta1 (Optional[Sequence[IPolicyValidationPluginBeta1]]) – Validation plugins to run after synthesis. Default: - no validation plugins

  • post_cli_context (Optional[Mapping[str, Any]]) – 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). Default: - no additional context

  • stack_traces (Optional[bool]) – Include construct creation stack trace in the aws:cdk:trace metadata key of all constructs. Default: true stack traces are included unless aws:cdk:disable-stack-trace is set in the context.

  • tree_metadata (Optional[bool]) – Include construct tree metadata as part of the Cloud Assembly. Default: true

ExampleMetadata:

infused

Example:

from aws_cdk.aws_s3 import BucketEncryption


app = App(
    default_stack_synthesizer=AppStagingSynthesizer.default_resources(
        app_id="my-app-id",
        staging_bucket_encryption=BucketEncryption.S3_MANAGED,
        deployment_identities=DeploymentIdentities.cli_credentials()
    )
)

Attributes

analytics_reporting

Include runtime versioning information in the Stacks of this app.

Default:

Value of ‘aws:cdk:version-reporting’ context key

auto_synth

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:

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

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

Default:
  • no additional context

default_stack_synthesizer

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:
  • A DefaultStackSynthesizer with default settings

outdir

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.

Default:

  • If this value is not set, considers the environment variable CDK_OUTDIR.

If CDK_OUTDIR is not defined, uses a temp directory.

policy_validation_beta1

Validation plugins to run after synthesis.

Default:
  • no validation plugins

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

Default:
  • no additional context

Example:

# context from the CLI and from `cdk.json` are stored in the
# CDK_CONTEXT env variable
cli_context = JSON.parse(process.env.CDK_CONTEXT)

# determine whether to take the context passed in the CLI or not
determine_value = process.env.PROD ? cliContext.SOMEKEY : 'my-prod-value'
App(
    post_cli_context={
        "SOMEKEY": determine_value
    }
)
stack_traces

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

Default:

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

tree_metadata

Include construct tree metadata as part of the Cloud Assembly.

Default:

true