View a markdown version of this page

为组织中的账户部署资源管理器 - Amazon Resource Explorer
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

为组织中的账户部署资源管理器

通过使用 Amazon CloudFormation StackSets,您可以定义并部署到组织中由管理的所有帐户 Amazon Organizations。定义堆栈集时,您可以指定要在您指定的所有目标账户 Amazon Web Services 区域 和所有目标账户中创建的 Amazon 资源。当所有账户都属于同一个组织时,你可以利用与 Organizations 的 Amazon CloudFormation 集成,让这些服务来处理跨账户角色的创建。您可以在组织中启用自动部署,这样可以自动将堆栈实例部署到您将来可能会添加到目标组织或组织单位(OU)的新账户。如果您从组织中移除账户,则 Amazon CloudFormation 会自动删除作为组织堆栈实例一部分部署的所有资源。有关的更多信息 StackSets,请参阅《Amazon CloudFormation 用户指南》 Amazon CloudFormation StackSets中的 “使用”。

您可以使用 Amazon CloudFormation StackSets 在组织 Amazon Resource Explorer 中的所有账户中开启和配置,在每个启用的区域中创建索引,并在需要时创建视图。

重要

如果您尝试在某个区域中设置聚合器索引,则必须确保该账户在任何其他区域中都没有现有的聚合器索引。将聚合器索引降级到本地索引后,必须等待 24 小时才能将另一个索引提升为该账户的新聚合器索引。

先决条件

Amazon CloudFormation StackSets 要使用资源管理器将资源管理器部署到组织中的账户,您或组织管理员必须先执行以下步骤以启用具有服务管理权限的堆栈:

  1. 的组织必须已启用所有功能。如果组织仅启用了整合账单功能时,您无法创建具有服务托管权限的堆栈集。

  2. 开启和 Organizations Amazon CloudFormation 之间的可信访问权限。这会授予在组织管理账户中创建所需角色的 Amazon CloudFormation 权限,成员账户 Amazon CloudFormation 将部署资源管理器索引和视图。

现在,您可以创建具有服务托管权限的堆栈集。

重要

您必须在组织的管理账户中创建堆栈集。 Amazon CloudFormation 是一项区域服务,因此您只能在最初创建堆栈集的区域中查看和管理您创建的堆栈集。

为资源管理器创建堆栈集

完全部署的资源管理器必须部署两个堆栈集。

  • 第一个堆栈集创建聚合器索引和默认视图,允许用户在账户中的所有区域中搜索资源。

    将此堆栈集部署到要在其中创建聚合器索引的单个区域。

  • 第二个堆栈集创建本地索引和默认视图。本地索引将其内容复制到聚合器索引。

    将此堆栈集部署到账户中包含聚合器索引的区域之外的所有已启用区域。不要在部署堆栈的账户中选择任何未启用的区域。如果您这样做,则部署将失败。

以下部分中列出了这些内容中每一个的示例模板。有关如何使用这些模板创建堆栈集的 step-by-step说明,请参阅《Amazon CloudFormation 用户指南》中的使用服务管理权限创建堆栈集

将这些堆栈集部署到您的组织后,您所选范围内的每个账户(组织或组织单位)在指定的区域中都有一个聚合索引,在其他每个区域都有本地索引。

示例 Amazon CloudFormation 模板

以下示例模板创建了账户的聚合器索引和默认视图,该视图可以在部署索引的账户中跨所有区域搜索资源。

YAML
Description: >- CFN Stack setting up ResourceExplorer with an Aggregator Index, and a new Default View. Resources: Index: Type: 'AWS::ResourceExplorer2::Index' Properties: Type: AGGREGATOR Tags: Purpose: ResourceExplorer CFN Stack View: Type: 'AWS::ResourceExplorer2::View' Properties: ViewName: DefaultView IncludedProperties: - Name: tags Tags: Purpose: ResourceExplorer CFN Stack DependsOn: Index DefaultViewAssociation: Type: 'AWS::ResourceExplorer2::DefaultViewAssociation' Properties: ViewArn: !Ref View
JSON
{ "Description": "CFN Stack setting up ResourceExplorer with an Aggregator Index, and a new Default View.", "Resources": { "Index": { "Type": "AWS::ResourceExplorer2::Index", "Properties": { "Type": "AGGREGATOR", "Tags": { "Purpose": "ResourceExplorer CFN Stack" } } }, "View": { "Type": "AWS::ResourceExplorer2::View", "Properties": { "ViewName": "DefaultView", "IncludedProperties": [{ "Name": "tags" }], "Tags": { "Purpose": "ResourceExplorer CFN Stack" } }, "DependsOn": "Index" }, "DefaultViewAssociation": { "Type": "AWS::ResourceExplorer2::DefaultViewAssociation", "Properties": { "ViewArn": { "Ref": "View" } } } } }

以下示例模板在每个已启用的区域中为除了具有聚合器索引的账户之外的所有账户创建本地索引。它还创建了一个默认视图,用户只能在该区域中搜索资源。用户必须使用聚合器区域中的视图进行搜索,才能在所有区域中搜索资源。

YAML
Description: >- CFN Stack setting up ResourceExplorer with a Local Index, and a new Default View. Resources: Index: Type: 'AWS::ResourceExplorer2::Index' Properties: Type: LOCAL Tags: Purpose: ResourceExplorer CFN Stack View: Type: 'AWS::ResourceExplorer2::View' Properties: ViewName: DefaultView IncludedProperties: - Name: tags Tags: Purpose: ResourceExplorer CFN Stack DependsOn: Index DefaultViewAssociation: Type: 'AWS::ResourceExplorer2::DefaultViewAssociation' Properties: ViewArn: !Ref View
JSON
{ "Description": "CFN Stack setting up ResourceExplorer with a Local Index, and a new Default View.", "Resources": { "Index": { "Type": "AWS::ResourceExplorer2::Index", "Properties": { "Type": "LOCAL", "Tags": { "Purpose": "ResourceExplorer CFN Stack" } } }, "View": { "Type": "AWS::ResourceExplorer2::View", "Properties": { "ViewName": "DefaultView", "IncludedProperties": [{ "Name": "tags" }], "Tags": { "Purpose": "ResourceExplorer CFN Stack" } }, "DependsOn": "Index" }, "DefaultViewAssociation": { "Type": "AWS::ResourceExplorer2::DefaultViewAssociation", "Properties": { "ViewArn": { "Ref": "View" } } } } }