aws-cdk-lib.aws_codepipeline_actions.CloudFormationDeployStackInstancesAction

class CloudFormationDeployStackInstancesAction

LanguageType name
.NETAmazon.CDK.AWS.CodePipeline.Actions.CloudFormationDeployStackInstancesAction
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodepipelineactions#CloudFormationDeployStackInstancesAction
Javasoftware.amazon.awscdk.services.codepipeline.actions.CloudFormationDeployStackInstancesAction
Pythonaws_cdk.aws_codepipeline_actions.CloudFormationDeployStackInstancesAction
TypeScript (source)aws-cdk-lib » aws_codepipeline_actions » CloudFormationDeployStackInstancesAction

Implements IAction

Extends Action

CodePipeline action to create/update Stack Instances of a StackSet.

After the initial creation of a stack set, you can add new stack instances by using CloudFormationStackInstances. Template parameter values can be overridden at the stack instance level during create or update stack set instance operations.

Each stack set has one template and set of template parameters. When you update the template or template parameters, you update them for the entire set. Then all instance statuses are set to OUTDATED until the changes are deployed to that instance.

Example

declare const pipeline: codepipeline.Pipeline;
declare const sourceOutput: codepipeline.Artifact;

pipeline.addStage({
  stageName: 'DeployStackSets',
  actions: [
    // First, update the StackSet itself with the newest template
    new codepipeline_actions.CloudFormationDeployStackSetAction({
      actionName: 'UpdateStackSet',
      runOrder: 1,
      stackSetName: 'MyStackSet',
      template: codepipeline_actions.StackSetTemplate.fromArtifactPath(sourceOutput.atPath('template.yaml')),

      // Change this to 'StackSetDeploymentModel.organizations()' if you want to deploy to OUs
      deploymentModel: codepipeline_actions.StackSetDeploymentModel.selfManaged(),
      // This deploys to a set of accounts
      stackInstances: codepipeline_actions.StackInstances.inAccounts(['111111111111'], ['us-east-1', 'eu-west-1']),
    }),

    // Afterwards, update/create additional instances in other accounts
    new codepipeline_actions.CloudFormationDeployStackInstancesAction({
      actionName: 'AddMoreInstances',
      runOrder: 2,
      stackSetName: 'MyStackSet',
      stackInstances: codepipeline_actions.StackInstances.inAccounts(
        ['222222222222', '333333333333'],
        ['us-east-1', 'eu-west-1']
      ),
    }),
  ],
});

Initializer

new CloudFormationDeployStackInstancesAction(props: CloudFormationDeployStackInstancesActionProps)

Parameters

  • props CloudFormationDeployStackInstancesActionProps

Properties

NameTypeDescription
actionPropertiesActionPropertiesThe simple properties of the Action, like its Owner, name, etc.

actionProperties

Type: ActionProperties

The simple properties of the Action, like its Owner, name, etc.

Note that this accessor will be called before the bind callback.

Methods

NameDescription
bind(scope, stage, options)The callback invoked when this Action is added to a Pipeline.
onStateChange(name, target?, options?)Creates an Event that will be triggered whenever the state of this Action changes.
protected bound(scope, _stage, options)This is a renamed version of the IAction.bind method.

bind(scope, stage, options)

public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig

Parameters

  • scope Construct
  • stage IStage
  • options ActionBindOptions

Returns

  • ActionConfig

The callback invoked when this Action is added to a Pipeline.


onStateChange(name, target?, options?)

public onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule

Parameters

  • name string
  • target IRuleTarget
  • options RuleProps

Returns

  • Rule

Creates an Event that will be triggered whenever the state of this Action changes.


protected bound(scope, _stage, options)

protected bound(scope: Construct, _stage: IStage, options: ActionBindOptions): ActionConfig

Parameters

  • scope Construct
  • _stage IStage
  • options ActionBindOptions

Returns

  • ActionConfig

This is a renamed version of the IAction.bind method.