Skip to content
v2.278.0

StageDeployment Class ​

Deployment of a single Stage.

A Stage consists of one or more Stacks, which will be deployed in dependency order.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { pipelines } from 'aws-cdk-lib';

declare const stack: cdk.Stack;
declare const stage: cdk.Stage;
declare const step: pipelines.Step;
const stageDeployment = pipelines.StageDeployment.fromStage(stage, /* all optional props */ {
  post: [step],
  pre: [step],
  stackSteps: [{
    stack: stack,

    // the properties below are optional
    changeSet: [step],
    post: [step],
    pre: [step],
  }],
  stageName: 'stageName',
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import pipelines

# stack: cdk.Stack
# stage: cdk.Stage
# step: pipelines.Step

stage_deployment = pipelines.StageDeployment.from_stage(stage,
    post=[step],
    pre=[step],
    stack_steps=[pipelines.StackSteps(
        stack=stack,

        # the properties below are optional
        change_set=[step],
        post=[step],
        pre=[step]
    )],
    stage_name="stageName"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.pipelines.*;

Stack stack;
Stage stage;
Step step;

StageDeployment stageDeployment = StageDeployment.fromStage(stage, StageDeploymentProps.builder()
        .post(List.of(step))
        .pre(List.of(step))
        .stackSteps(List.of(StackSteps.builder()
                .stack(stack)

                // the properties below are optional
                .changeSet(List.of(step))
                .post(List.of(step))
                .pre(List.of(step))
                .build()))
        .stageName("stageName")
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.Pipelines;

Stack stack;
Stage stage;
Step step;

var stageDeployment = StageDeployment.FromStage(stage, new StageDeploymentProps {
    Post = new [] { step },
    Pre = new [] { step },
    StackSteps = new [] { new StackSteps {
        Stack = stack,

        // the properties below are optional
        ChangeSet = new [] { step },
        Post = new [] { step },
        Pre = new [] { step }
    } },
    StageName = "stageName"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var stack Stack
var stage Stage
var step Step

stageDeployment := awscdk.Pipelines.StageDeployment_FromStage(stage, &StageDeploymentProps{
	Post: []Step{
		step,
	},
	Pre: []Step{
		step,
	},
	StackSteps: []StackSteps{
		&StackSteps{
			Stack: stack,

			// the properties below are optional
			ChangeSet: []Step{
				step,
			},
			Post: []Step{
				step,
			},
			Pre: []Step{
				step,
			},
		},
	},
	StageName: jsii.String("stageName"),
})

Properties ​

postStep[]posttyping.List[Step]postList<Step>PostStep[]Post*[]Step #
Additional steps that are run after all of the stacks in the stage.
preStep[]pretyping.List[Step]preList<Step>PreStep[]Pre*[]Step #
Additional steps that are run before any of the stacks in the stage.
prepareStepmay be undefinedbooleanprepare_stepmay be undefinedboolprepareStepmay be undefinedBooleanPrepareStepmay be undefinedboolPrepareStepmay be undefined*bool #
Determine if all stacks in stage should be deployed with prepare step or not.
stacksStackDeployment[]stackstyping.List[StackDeployment]stacksList<StackDeployment>StacksStackDeployment[]Stacks*[]StackDeployment #
The stacks deployed in this stage.
stackStepsStackSteps[]stack_stepstyping.List[StackSteps]stackStepsList<StackSteps>StackStepsStackSteps[]StackSteps*[]StackSteps #
Instructions for additional steps that are run at stack level.
stageNamestringstage_namestrstageNameStringStageNamestringStageName*string #
The display name of this stage.

Methods ​

addPost(...steps: Step[]): voiddef add_post(self, steps: Step) -> Nonepublic void addPost(Step steps)public void AddPost(Step steps)func AddPost(Steps Step) #
Add an additional step to run after all of the stacks in this stage.
addPre(...steps: Step[]): voiddef add_pre(self, steps: Step) -> Nonepublic void addPre(Step steps)public void AddPre(Step steps)func AddPre(Steps Step) #
Add an additional step to run before any of the stacks in this stage.
fromStage(stage: Stage, props?: StageDeploymentProps): StageDeployment // chainable@staticmethod def from_stage(stage: Stage, props: typing.Optional[StageDeploymentProps] = None) -> StageDeploymentpublic static StageDeployment fromStage(Stage stage, StageDeploymentProps props)public static StageDeployment FromStage(Stage stage, StageDeploymentProps? props = null)func FromStage(Stage Stage, Props StageDeploymentProps) StageDeployment static #
Create a new `StageDeployment` from a `Stage`.

Synthesizes the target stage, and deployes the stacks found inside in dependency order.