Table of Contents

Class StageProps

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

Initialization props for a stage.

public class StageProps : IStageProps
Inheritance
StageProps
Implements
Inherited Members

Examples

CodePipeline pipeline;
            class MyOutputStage : Stage
            {
                public CfnOutput LoadBalancerAddress { get; }

                public MyOutputStage(Construct scope, string id, StageProps? props=null) : base(scope, id, props)
                {
                    LoadBalancerAddress = new CfnOutput(this, "Output", new CfnOutputProps { Value = "value" });
                }
            }

            var lbApp = new MyOutputStage(this, "MyApp");
            pipeline.AddStage(lbApp, new AddStageOpts {
                Post = new [] {
                    new ShellStep("HitEndpoint", new ShellStepProps {
                        EnvFromCfnOutputs = new Dictionary<string, CfnOutput> {
                            // Make the load balancer address available as $URL inside the commands
                            { "URL", lbApp.LoadBalancerAddress }
                        },
                        Commands = new [] { "curl -Ssf $URL" }
                    }) }
            });

Remarks

ExampleMetadata: infused

Constructors

StageProps()

public StageProps()

Properties

Env

Default AWS environment (account/region) for Stacks in this Stage.

public IEnvironment? Env { get; set; }

Property Value

IEnvironment

Examples

// Use a concrete account and region to deploy this Stage to
             // Use a concrete account and region to deploy this Stage to
             new Stage(app, "Stage1", new StageProps {
                 Env = new Environment { Account = "123456789012", Region = "us-east-1" }
             });

             // Use the CLI's current credentials to determine the target environment
             // Use the CLI's current credentials to determine the target environment
             new Stage(app, "Stage2", new StageProps {
                 Env = new Environment { Account = process.Env.CDK_DEFAULT_ACCOUNT, Region = process.Env.CDK_DEFAULT_REGION }
             });

Remarks

Stacks defined inside this Stage with either region or account missing from its env will use the corresponding field given here.

If either region or accountis is not configured for Stack (either on the Stack itself or on the containing Stage), 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 Stacks.

Outdir

The output directory into which to emit synthesized artifacts.

public string? Outdir { get; set; }

Property Value

string

Remarks

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.