Class StackInstances
Where Stack Instances will be created from the StackSet.
Inheritance
Namespace: Amazon.CDK.AWS.CodePipeline.Actions
Assembly: Amazon.CDK.AWS.CodePipeline.Actions.dll
Syntax (csharp)
public abstract class StackInstances : DeputyBase
Syntax (vb)
Public MustInherit Class StackInstances
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
Pipeline pipeline;
Artifact sourceOutput;
pipeline.AddStage(new StageOptions {
StageName = "DeployStackSets",
Actions = new [] {
// First, update the StackSet itself with the newest template
new CloudFormationDeployStackSetAction(new CloudFormationDeployStackSetActionProps {
ActionName = "UpdateStackSet",
RunOrder = 1,
StackSetName = "MyStackSet",
Template = StackSetTemplate.FromArtifactPath(sourceOutput.AtPath("template.yaml")),
// Change this to 'StackSetDeploymentModel.organizations()' if you want to deploy to OUs
DeploymentModel = StackSetDeploymentModel.SelfManaged(),
// This deploys to a set of accounts
StackInstances = StackInstances.InAccounts(new [] { "111111111111" }, new [] { "us-east-1", "eu-west-1" })
}),
// Afterwards, update/create additional instances in other accounts
new CloudFormationDeployStackInstancesAction(new CloudFormationDeployStackInstancesActionProps {
ActionName = "AddMoreInstances",
RunOrder = 2,
StackSetName = "MyStackSet",
StackInstances = StackInstances.InAccounts(new [] { "222222222222", "333333333333" }, new [] { "us-east-1", "eu-west-1" })
}) }
});
Synopsis
Constructors
StackInstances() | |
StackInstances(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
StackInstances(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
FromArtifactPath(ArtifactPath_, String[]) | 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. |
InAccounts(String[], String[]) | Create stack instances in a set of accounts and regions passed as literal lists. |
InOrganizationalUnits(String[], String[]) | Create stack instances in all accounts in a set of Organizational Units (OUs) and regions passed as literal lists. |
Constructors
StackInstances()
protected StackInstances()
StackInstances(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected StackInstances(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
StackInstances(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected StackInstances(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
FromArtifactPath(ArtifactPath_, String[])
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.
public static StackInstances FromArtifactPath(ArtifactPath_ artifactPath, string[] regions)
Parameters
- artifactPath ArtifactPath_
- regions System.String[]
Returns
Remarks
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.
InAccounts(String[], String[])
Create stack instances in a set of accounts and regions passed as literal lists.
public static StackInstances InAccounts(string[] accounts, string[] regions)
Parameters
- accounts System.String[]
- regions System.String[]
Returns
Remarks
Stack Instances will be created in every combination of region and account.
NOTE: StackInstances.inAccounts()
and StackInstances.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.
InOrganizationalUnits(String[], String[])
Create stack instances in all accounts in a set of Organizational Units (OUs) and regions passed as literal lists.
public static StackInstances InOrganizationalUnits(string[] ous, string[] regions)
Parameters
- ous System.String[]
- regions System.String[]
Returns
Remarks
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()
and StackInstances.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.