class StackInstances
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodePipeline.Actions.StackInstances |
Java | software.amazon.awscdk.services.codepipeline.actions.StackInstances |
Python | aws_cdk.aws_codepipeline_actions.StackInstances |
TypeScript (source) | @aws-cdk/aws-codepipeline-actions » StackInstances |
Where Stack Instances will be created from the StackSet.
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 StackInstances()
Methods
Name | Description |
---|---|
static from | Create stack instances in a set of accounts or organizational units taken from the pipeline artifacts, and a set of regions The file must be a JSON file containing a list of strings. |
static in | Create stack instances in a set of accounts and regions passed as literal lists. |
static in | Create stack instances in all accounts in a set of Organizational Units (OUs) and regions passed as literal lists. |
static fromArtifactPath(artifactPath, regions)
public static fromArtifactPath(artifactPath: ArtifactPath, regions: string[]): StackInstances
Parameters
- artifactPath
Artifact
Path - regions
string[]
Returns
Create stack instances in a set of accounts or organizational units taken from the pipeline artifacts, and a set of regions The file must be a JSON file containing a list of strings.
For example:
[
"111111111111",
"222222222222",
"333333333333"
]
Stack Instances will be created in every combination of region and account, or region and Organizational Units (OUs).
If this is set of Organizational Units, you must have selected StackSetDeploymentModel.organizations()
as deployment model.
static inAccounts(accounts, regions)
public static inAccounts(accounts: string[], regions: string[]): StackInstances
Parameters
- accounts
string[]
- regions
string[]
Returns
Create stack instances in a set of accounts and regions passed as literal lists.
Stack Instances will be created in every combination of region and account.
NOTE:
StackInstances.inAccounts()
andStackInstances.inOrganizationalUnits()
have exactly the same behavior, and you can use them interchangeably if you want. The only difference between them is that your code clearly indicates what entity it's working with.
static inOrganizationalUnits(ous, regions)
public static inOrganizationalUnits(ous: string[], regions: string[]): StackInstances
Parameters
- ous
string[]
- regions
string[]
Returns
Create stack instances in all accounts in a set of Organizational Units (OUs) and regions passed as literal lists.
If you want to deploy to Organization Units, you must choose have created the StackSet
with deploymentModel: DeploymentModel.organizations()
.
Stack Instances will be created in every combination of region and account.
NOTE:
StackInstances.inAccounts()
andStackInstances.inOrganizationalUnits()
have exactly the same behavior, and you can use them interchangeably if you want. The only difference between them is that your code clearly indicates what entity it's working with.