

# 为 Performance Insights 创建自定义 IAM 策略
<a name="USER_PerfInsights.access-control.custom-policy"></a>

对于没有 `AmazonRDSPerformanceInsightsReadOnly` 或 `AmazonRDSPerformanceInsightsFullAccess` 策略的用户，可以通过创建或修改用户托管式 IAM 策略，来授予对 Performance Insights 的访问权限。在将策略附加到 IAM 权限集或角色时，接收人可以使用 Performance Insights。

**创建自定义策略**

1. 打开 IAM 控制台：[https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/)。

1. 在导航窗格中，选择**策略**。

1. 选择**创建策略**。

1. 在**创建策略**页面上，选择 **JSON** 选项。

1. 复制并粘贴**《AWS 托管策略参考指南》中的 *JSON 策略文档*部分提供的有关 [https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSPerformanceInsightsReadOnly.html](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSPerformanceInsightsReadOnly.html) 或 [https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSPerformanceInsightsFullAccess.html](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSPerformanceInsightsFullAccess.html) 策略的文本。

1. 选择**查看策略**。

1. 为策略提供名称并可以选择提供描述，然后选择**创建策略**。

现在，可以将策略附加到权限集或角色。以下过程假设您已经有一个可用于此目的的用户。

**将策略附加到用户**

1. 打开 IAM 控制台：[https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/)。

1. 在导航窗格中，选择 **Users**。

1. 从列表中选择现有用户。
**重要**  
要使用 Performance Insights，请确保除了自定义策略之外，您还有权访问 Amazon RDS。例如，`AmazonRDSPerformanceInsightsReadOnly` 预定义策略提供了对 Amazon RDS 的只读访问权限。有关更多信息，请参阅“[使用策略管理访问](UsingWithRDS.IAM.md#security_iam_access-manage)”。

1. 在 **Summary (摘要)** 页上，选择 **Add permissions (添加权限)**。

1. 选择**直接附加现有策略**。对于**搜索**，键入策略名称的前几个字符，如下图所示。  
![\[选择一个策略\]](http://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/AuroraUserGuide/images/perf_insights_attach_iam_policy.png)

1. 选择策略，然后选择 **Next: Review**。

1. 选择 **Add permissions (添加权限)**。