View a markdown version of this page

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

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

使用 CloudFormation 创建资源管理器资源

Amazon Resource Explorer 与 Amazon CloudFormation 集成,后者是一项可帮助您建模和设置 Amazon 资源的服务。此集成可帮助您花费更少的时间来创建和管理您的资源和基础设施。您可以创建一个描述所需的全部 Amazon 资源的模板,CloudFormation 将为您预调配和配置这些资源。资源的示例包括索引、视图或为 Amazon Web Services 区域 进行的默认视图分配。

在您使用 CloudFormation 时,可重复使用您的模板来不断地重复设置您的资源管理器资源。描述您的资源一次,然后在多个 Amazon Web Services 账户 和区域中反复预调配相同的资源。

使用 Amazon CloudFormation 将资源管理器部署到 Amazon Organizations

您可以使用 Amazon CloudFormation StackSets 将资源管理器部署到组织中的所有账户。当您在组织中添加或创建成员账户时,StackSets 可以自动将每个 Amazon Web Services 区域 的索引配置到新的成员账户,包括您指定的聚合器索引。有关说明,请参阅 为组织中的账户部署资源管理器

资源管理器和 CloudFormation 模板

要为资源管理器和相关服务预调配和配置资源,您必须了解 Amazon CloudFormation 模板。模板是 JSON 或 YAML 格式的文本文件。这些模板描述要在 CloudFormation 堆栈中预调配的资源。如果您不熟悉 JSON 或 YAML,可以在 Amazon CloudFormation Designer 的帮助下开始使用 CloudFormation 模板。有关更多信息,请参阅Amazon CloudFormation用户指南中的什么是 Amazon CloudFormation Designer?

资源管理器支持在 CloudFormation 中创建以下资源类型:

以下示例说明了如何在同一个区域中创建一个索引和一个视图,并将该视图设置为该区域的默认视图。

YAML

Description: >- Sample CFN Stack setting up Resource Explorer with an aggregator index and a default view Resources: SampleIndex: Type: 'AWS::ResourceExplorer2::Index' Properties: Type: AGGREGATOR Tags: Purpose: ResourceExplorer Sample CFN Stack SampleView: Type: 'AWS::ResourceExplorer2::View' Properties: ViewName: mySampleView IncludedProperties: - Name: tags Tags: Purpose: ResourceExplorer Sample CFN Stack DependsOn: SampleIndex SampleDefaultViewAssociation: Type: 'AWS::ResourceExplorer2::DefaultViewAssociation' Properties: ViewArn: !Ref SampleView

JSON

{ "Description": "Sample CFN Stack setting up Resource Explorer with an aggregator index and a default view ", "Resources": { "SampleIndex": { "Type": "AWS::ResourceExplorer2::Index", "Properties": { "Type": "AGGREGATOR", "Tags": { "Purpose": "ResourceExplorer Sample Stack" } } }, "SampleView": { "Type": "AWS::ResourceExplorer2::View", "Properties": { "ViewName": "mySampleView", "IncludedProperties": [ { "Name": "tags" } ], "Tags": { "Purpose": "ResourceExplorer Sample CFN Stack" } }, "DependsOn": "SampleIndex" }, "SampleDefaultViewAssociation": { "Type": "AWS::ResourceExplorer2::DefaultViewAssociation", "Properties": { "ViewArn": { "Ref": "SampleView" } } } } }

有关更多信息(包括资源管理器索引和视图的 JSON 和 YAML 模板示例),请参阅《Amazon CloudFormation 用户指南》中的 ResourceExplorer2 资源类型参考

了解有关 Amazon CloudFormation 的更多信息

要了解有关 CloudFormation 的更多信息,请参阅以下资源: