class CloudFormationDeployStackSetAction
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodePipeline.Actions.CloudFormationDeployStackSetAction |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscodepipelineactions#CloudFormationDeployStackSetAction |
Java | software.amazon.awscdk.services.codepipeline.actions.CloudFormationDeployStackSetAction |
Python | aws_cdk.aws_codepipeline_actions.CloudFormationDeployStackSetAction |
TypeScript (source) | aws-cdk-lib » aws_codepipeline_actions » CloudFormationDeployStackSetAction |
Implements
IAction
Extends
Action
CodePipeline action to deploy a stackset.
CodePipeline offers the ability to perform AWS CloudFormation StackSets operations as part of your CI/CD process. You use a stack set to create stacks in AWS accounts across AWS Regions by using a single AWS CloudFormation template. All the resources included in each stack are defined by the stack set’s AWS CloudFormation template. When you create the stack set, you specify the template to use, as well as any parameters and capabilities that the template requires.
For more information about concepts for AWS CloudFormation StackSets, see StackSets concepts in the AWS CloudFormation User Guide.
If you use this action to make an update that includes adding stack instances, the new instances are deployed first and the update is completed last. The new instances first receive the old version, and then the update is applied to all instances.
As a best practice, you should construct your pipeline so that the stack set is created and initially deploys to a subset or a single instance. After you test your deployment and view the generated stack set, then add the CloudFormationStackInstances action so that the remaining instances are created and updated.
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 CloudFormationDeployStackSetAction(props: CloudFormationDeployStackSetActionProps)
Parameters
Properties
Name | Type | Description |
---|---|---|
action | Action | The simple properties of the Action, like its Owner, name, etc. |
actionProperties
Type:
Action
The simple properties of the Action, like its Owner, name, etc.
Note that this accessor will be called before the bind
callback.
Methods
Name | Description |
---|---|
bind(scope, stage, options) | The callback invoked when this Action is added to a Pipeline. |
on | 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
Action
Bind Options
Returns
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
IRule
Target - options
Rule
Props
Returns
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
Action
Bind Options
Returns
This is a renamed version of the IAction.bind
method.