Table of Contents

Class Stage

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

An abstract application modeling unit consisting of Stacks that should be deployed together.

public class Stage : Construct, IConstruct, IConstruct, IDependable
Inheritance
Stage
Implements
IConstruct
Derived
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

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.

ExampleMetadata: infused

Constructors

Stage(Construct, string, IStageProps?)

public Stage(Construct scope, string id, IStageProps? props = null)

Parameters

scope Construct
id string
props IStageProps

Properties

Account

The default account for all resources defined within this stage.

public virtual string? Account { get; }

Property Value

string

ArtifactId

Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string.

public virtual string ArtifactId { get; }

Property Value

string

Remarks

Derived from the construct path.

AssetOutdir

The cloud assembly asset output directory.

public virtual string AssetOutdir { get; }

Property Value

string

Outdir

The cloud assembly output directory.

public virtual string Outdir { get; }

Property Value

string

ParentStage

The parent stage or undefined if this is the app.

public virtual Stage? ParentStage { get; }

Property Value

Stage

Remarks

    Region

    The default region for all resources defined within this stage.

    public virtual string? Region { get; }

    Property Value

    string

    StageName

    The name of the stage.

    public virtual string StageName { get; }

    Property Value

    string

    Remarks

    Based on names of the parent stages separated by hypens.

    Methods

    IsStage(object)

    Test whether the given construct is a stage.

    public static bool IsStage(object x)

    Parameters

    x object

    Returns

    bool

    Of(IConstruct)

    Return the stage this construct is contained with, if available.

    public static Stage? Of(IConstruct construct)

    Parameters

    construct IConstruct

    Returns

    Stage

    Remarks

    If called on a nested stage, returns its parent.

    Synth(IStageSynthesisOptions?)

    Synthesize this stage into a cloud assembly.

    public virtual CloudAssembly Synth(IStageSynthesisOptions? options = null)

    Parameters

    options IStageSynthesisOptions

    Returns

    CloudAssembly

    Remarks

    Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly.