Class StackSetDeploymentModel
Determines how IAM roles are created and managed.
Inheritance
Namespace: Amazon.CDK.AWS.CodePipeline.Actions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class StackSetDeploymentModel : DeputyBase
Syntax (vb)
Public MustInherit Class StackSetDeploymentModel
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
StackSetDeploymentModel() | |
StackSetDeploymentModel(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
StackSetDeploymentModel(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
Organizations(IOrganizationsDeploymentProps) | Deploy to AWS Organizations accounts. |
SelfManaged(ISelfManagedDeploymentProps) | Deploy to AWS Accounts not managed by AWS Organizations. |
Constructors
StackSetDeploymentModel()
protected StackSetDeploymentModel()
StackSetDeploymentModel(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected StackSetDeploymentModel(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
StackSetDeploymentModel(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected StackSetDeploymentModel(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
Organizations(IOrganizationsDeploymentProps)
Deploy to AWS Organizations accounts.
public static StackSetDeploymentModel Organizations(IOrganizationsDeploymentProps props = null)
Parameters
Returns
Remarks
AWS CloudFormation StackSets automatically creates the IAM roles required to deploy to accounts managed by AWS Organizations. This requires an account to be a member of an Organization.
Using this deployment model, you can specify either AWS Account Ids or
Organization Unit Ids in the stackInstances
parameter.
SelfManaged(ISelfManagedDeploymentProps)
Deploy to AWS Accounts not managed by AWS Organizations.
public static StackSetDeploymentModel SelfManaged(ISelfManagedDeploymentProps props = null)
Parameters
Returns
Remarks
You are responsible for creating Execution Roles in every account you will
be deploying to in advance to create the actual stack instances. Unless you
specify overrides, StackSets expects the execution roles you create to have
the default name AWSCloudFormationStackSetExecutionRole
. See the Grant
self-managed
permissions
section of the CloudFormation documentation.
The CDK will automatically create the central Administration Role in the Pipeline account which will be used to assume the Execution Role in each of the target accounts.
If you wish to use a pre-created Administration Role, use Role.fromRoleName()
or Role.fromRoleArn()
to import it, and pass it to this function:
var existingAdminRole = Role.FromRoleName(this, "AdminRole", "AWSCloudFormationStackSetAdministrationRole");
var deploymentModel = StackSetDeploymentModel.SelfManaged(new SelfManagedDeploymentProps {
// Use an existing Role. Leave this out to create a new Role.
AdministrationRole = existingAdminRole
});
Using this deployment model, you can only specify AWS Account Ids in the
stackInstances
parameter.
See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html