Stage¶
-
class
aws_cdk.core.
Stage
(scope, id, *, env=None, outdir=None)¶ Bases:
aws_cdk.core.Construct
An abstract application modeling unit consisting of Stacks that should be deployed together.
Derive a subclass of
Stage
and use it to model a single instance of your application.You can then instantiate your subclass multiple times to model multiple copies of your application which should be be deployed to different environments.
- Parameters
scope (
Construct
) –id (
str
) –env (
Optional
[Environment
]) – Default AWS environment (account/region) forStack``s in this ``Stage
. Stacks defined inside thisStage
with eitherregion
oraccount
missing from its env will use the corresponding field given here. If eitherregion
oraccount``is is not configured for ``Stack
(either on theStack
itself or on the containingStage
), the Stack will be environment-agnostic. Environment-agnostic stacks can be deployed to any environment, may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups, will not automatically translate Service Principals to the right format based on the environment’s AWS partition, and other such enhancements. Default: - The environments should be configured on the ``Stack``s.outdir (
Optional
[str
]) – The output directory into which to emit synthesized artifacts. Can only be specified if this stage is the root stage (the app). If this is specified and this stage is nested within another stage, an error will be thrown. Default: - for nested stages, outdir will be determined as a relative directory to the outdir of the app. For apps, if outdir is not specified, a temporary directory will be created.
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_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