StageProps
- class aws_cdk.core.StageProps(*, env=None, outdir=None)
Bases:
object
Initialization props for a stage.
- Parameters:
env (
Union
[Environment
,Dict
[str
,Any
],None
]) – 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.
- ExampleMetadata:
infused
Example:
# pipeline: pipelines.CodePipeline class MyOutputStage(Stage): def __init__(self, scope, id, *, env=None, outdir=None): super().__init__(scope, id, env=env, outdir=outdir) self.load_balancer_address = CfnOutput(self, "Output", value="value") lb_app = MyOutputStage(self, "MyApp") pipeline.add_stage(lb_app, post=[ pipelines.ShellStep("HitEndpoint", env_from_cfn_outputs={ # Make the load balancer address available as $URL inside the commands "URL": lb_app.load_balancer_address }, commands=["curl -Ssf $URL"] ) ] )
Attributes
- env
Default AWS environment (account/region) for
Stack``s in this ``Stage
.Stacks defined inside this
Stage
with eitherregion
oraccount
missing from its env will use the corresponding field given here.If either
region
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.
Example:
# Use a concrete account and region to deploy this Stage to Stage(app, "Stage1", env=Environment(account="123456789012", region="us-east-1") ) # Use the CLI's current credentials to determine the target environment Stage(app, "Stage2", env=Environment(account=process.env.CDK_DEFAULT_ACCOUNT, region=process.env.CDK_DEFAULT_REGION) )
- outdir
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.