App

class aws_cdk.core.App(*, auto_synth=None, context=None, outdir=None, runtime_info=None, stack_traces=None, tree_metadata=None)

Bases: aws_cdk.core.Construct

A construct which represents an entire CDK app. This construct is normally the root of the construct tree.

You would normally define an App instance in your program’s entrypoint, then define constructs where the app is used as the parent scope.

After all the child constructs are defined within the app, you should call app.synth() which will emit a “cloud assembly” from this app into the directory specified by outdir. Cloud assemblies includes artifacts such as CloudFormation templates and assets that are needed to deploy this app into the AWS cloud.

see :see: https://docs.aws.amazon.com/cdk/latest/guide/apps_and_stacks.html

__init__(*, auto_synth=None, context=None, outdir=None, runtime_info=None, stack_traces=None, tree_metadata=None)

Initializes a CDK application.

Parameters
  • props – initialization properties.

  • 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, str]]) – 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

  • outdir (Optional[str]) – The output directory into which to emit synthesized artifacts. Default: - If this value is not set, considers the environment variable CDK_OUTDIR. If CDK_OUTDIR is not defined, uses a temp directory.

  • runtime_info (Optional[bool]) – Include runtime versioning information in cloud assembly manifest. Default: true runtime info is included unless aws:cdk:disable-runtime-info is set in the 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

Return type

None

Methods

synth()

Synthesizes a cloud assembly for this app.

Emits it to the directory specified by outdir.

return :rtype: CloudAssembly :return:

a CloudAssembly which can be used to inspect synthesized artifacts such as CloudFormation templates and assets.

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

Static Methods

classmethod is_app(obj)

Checks if an object is an instance of the App class.

Parameters

obj (Any) – The object to evaluate.

return :rtype: bool :return: true if obj is an App.

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool