App¶
-
class
aws_cdk.core.
App
(*, analytics_reporting=None, auto_synth=None, context=None, outdir=None, runtime_info=None, stack_traces=None, tree_metadata=None)¶ Bases:
aws_cdk.core.Stage
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 byoutdir
. Cloud assemblies includes artifacts such as CloudFormation templates and assets that are needed to deploy this app into the AWS cloud.Initializes a CDK application.
- Parameters
analytics_reporting (
Optional
[bool
]) – Include runtime versioning information in the Stacks of this app. Default: Value of ‘aws:cdk:version-reporting’ context keyauto_synth (
Optional
[bool
]) – Automatically callsynth()
before the program exits. If you set this, you don’t have to callsynth()
explicitly. Note that this feature is only available for certain programming languages, and callingsynth()
is still recommended. Default: true if running via CDK CLI (CDK_OUTDIR
is set),false
otherwisecontext (
Optional
[Mapping
[str
,Any
]]) – Additional context values for the application. Context set by the CLI or thecontext
key incdk.json
has precedence. Context can be read from any construct usingnode.getContext(key)
. Default: - no additional contextoutdir (
Optional
[str
]) – The output directory into which to emit synthesized artifacts. Default: - If this value is not set, considers the environment variableCDK_OUTDIR
. IfCDK_OUTDIR
is not defined, uses a temp directory.runtime_info (
Optional
[bool
]) – (deprecated) Include runtime versioning information in the Stacks of this app. Default: Value of ‘aws:cdk:version-reporting’ context keystack_traces (
Optional
[bool
]) – Include construct creation stack trace in theaws:cdk:trace
metadata key of all constructs. Default: true stack traces are included unlessaws: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
Methods
-
synth
(*, force=None, skip_validation=None)¶ Synthesize this stage into a cloud assembly.
Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly.
- Parameters
force (
Optional
[bool
]) – Force a re-synth, even if the stage has already been synthesized. This is used by tests to allow for incremental verification of the output. Do not use in production. Default: falseskip_validation (
Optional
[bool
]) – Should we skip construct validation. Default: - false
- Return type
-
to_string
()¶ Returns a string representation of this construct.
- Return type
str
Attributes
-
account
¶ (experimental) The default account for all resources defined within this stage.
- Stability
experimental
- Return type
Optional
[str
]
-
artifact_id
¶ (experimental) Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string.
Derived from the construct path.
- Stability
experimental
- Return type
str
-
asset_outdir
¶ The cloud assembly asset output directory.
- Return type
str
-
node
¶ The construct tree node associated with this construct.
- Return type
-
outdir
¶ The cloud assembly output directory.
- Return type
str
-
parent_stage
¶ (experimental) The parent stage or
undefined
if this is the app.- Stability
experimental
- Return type
Optional
[Stage
]
-
region
¶ (experimental) The default region for all resources defined within this stage.
- Stability
experimental
- Return type
Optional
[str
]
-
stage_name
¶ (experimental) The name of the stage.
Based on names of the parent stages separated by hypens.
- Stability
experimental
- Return type
str
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 type
bool
- Returns
true
ifobj
is anApp
.
-
classmethod
is_construct
(x)¶ Return whether the given object is a Construct.
- Parameters
x (
Any
) –- Return type
bool
-
classmethod
is_stage
(x)¶ (experimental) Test whether the given construct is a stage.
- Parameters
x (
Any
) –- Stability
experimental
- Return type
bool
-
classmethod
of
(construct)¶ (experimental) Return the stage this construct is contained with, if available.
If called on a nested stage, returns its parent.
- Parameters
construct (
IConstruct
) –- Stability
experimental
- Return type
Optional
[Stage
]