如何在同一个 AWS 账户和区域中部署同一个堆栈集的多个实例?
How to deploy multiple instances of the same stackset in the same AWS account and region?
我正在创建一个多租户架构。每当有新租户注册我的平台时,我都需要复制我的资源。
我在我的 SAM 项目中创建了一个堆栈集,如下所示:
StackSet:
Type: AWS::CloudFormation::StackSet
Properties:
Capabilities:
- "CAPABILITY_IAM"
- "CAPABILITY_NAMED_IAM"
- "CAPABILITY_AUTO_EXPAND"
AdministrationRoleARN: !GetAtt AdministrationRole.Arn
ExecutionRoleName: !Ref ExecutionRole
OperationPreferences:
FailureToleranceCount: 0
MaxConcurrentCount: 1
PermissionModel: 'SELF_MANAGED'
StackInstancesGroup:
- DeploymentTargets:
Accounts:
- !Ref AWS::AccountId
Regions:
- !Ref AWS::Region
- DeploymentTargets:
Accounts:
- !Ref AWS::AccountId
Regions:
- !Ref AWS::Region
Tags:
-
Key: 'PROJECT'
Value: 'imaclegal'
StackSetName: 'imaclegal'
TemplateURL: 'https://s3.amazonaws.com/a-child-s3/output.yaml'
当我执行 sam deploy
时出现此错误:
Properties validation failed for resource StackSet with message: #:
#: only 1 subschema matches out of 2 #/StackInstancesGroup: array items are not unique
所以我似乎无法在同一个AWS账户和区域中部署超过1个实例,有什么办法可以在同一个AWS账户和区域中完成多个实例吗?或者有没有其他更好的方法来为我的新租户复制我的资源?
如果您想将所有资源保存在一个 account/region 中,CloudFormation StackSets 目前无法满足您的需求。
如果您的资源未在您的模板中命名,您可以创建多个 CloudFormation 堆栈。不过,这可能会导致维护变得混乱,而且如果您是 运行 大规模应用程序,您更有可能达到服务配额。
就我个人而言,我建议使用 AWS Organizations 为每个租户创建一个帐户。然后可以使用 CloudFormation StackSets 将您的资源自动复制到新帐户。
此解决方案还具有为每个租户更精确地分配成本的额外好处。
我正在创建一个多租户架构。每当有新租户注册我的平台时,我都需要复制我的资源。
我在我的 SAM 项目中创建了一个堆栈集,如下所示:
StackSet:
Type: AWS::CloudFormation::StackSet
Properties:
Capabilities:
- "CAPABILITY_IAM"
- "CAPABILITY_NAMED_IAM"
- "CAPABILITY_AUTO_EXPAND"
AdministrationRoleARN: !GetAtt AdministrationRole.Arn
ExecutionRoleName: !Ref ExecutionRole
OperationPreferences:
FailureToleranceCount: 0
MaxConcurrentCount: 1
PermissionModel: 'SELF_MANAGED'
StackInstancesGroup:
- DeploymentTargets:
Accounts:
- !Ref AWS::AccountId
Regions:
- !Ref AWS::Region
- DeploymentTargets:
Accounts:
- !Ref AWS::AccountId
Regions:
- !Ref AWS::Region
Tags:
-
Key: 'PROJECT'
Value: 'imaclegal'
StackSetName: 'imaclegal'
TemplateURL: 'https://s3.amazonaws.com/a-child-s3/output.yaml'
当我执行 sam deploy
时出现此错误:
Properties validation failed for resource StackSet with message: #: #: only 1 subschema matches out of 2 #/StackInstancesGroup: array items are not unique
所以我似乎无法在同一个AWS账户和区域中部署超过1个实例,有什么办法可以在同一个AWS账户和区域中完成多个实例吗?或者有没有其他更好的方法来为我的新租户复制我的资源?
如果您想将所有资源保存在一个 account/region 中,CloudFormation StackSets 目前无法满足您的需求。 如果您的资源未在您的模板中命名,您可以创建多个 CloudFormation 堆栈。不过,这可能会导致维护变得混乱,而且如果您是 运行 大规模应用程序,您更有可能达到服务配额。
就我个人而言,我建议使用 AWS Organizations 为每个租户创建一个帐户。然后可以使用 CloudFormation StackSets 将您的资源自动复制到新帐户。
此解决方案还具有为每个租户更精确地分配成本的额外好处。