本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
为 Performance Insights 配置访问策略
要访问 Performance Insights,您必须拥有 Amazon Identity and Access Management (IAM)的相应权限。您可以使用以下选项来授予访问权限:
-
将
AmazonRDSPerformanceInsightsReadOnly
托管式策略附加到权限集或角色。 -
创建自定义 IAM policy 并将其附加到权限集或角色。
此外,如果您在启用 Performance Insights 时指定了客户托管密钥,请确保账户中的用户对 KMS 密钥具有 kms:Decrypt
和 kms:GenerateDataKey
权限。
将 Amazon RDSPerformance InsightsReadOnly 政策附加到 IAM 委托人
AmazonRDSPerformanceInsightsReadOnly
是一项 Amazon托管策略,允许访问亚马逊 DocumentDB Performance Insights API 的所有只读操作。目前,此 API 中的所有操作均为只读。如果将 AmazonRDSPerformanceInsightsReadOnly
附加到权限集或角色,接收人可以使用 Performance Insights 以及其他控制台功能。
为 Performance Insights 创建自定义 IAM policy
对于没有 AmazonRDSPerformanceInsightsReadOnly
策略的用户,您可以通过创建或修改用户托管 IAM policy 来授予对 Performance Insights 的访问权限。当您将策略附加到一个权限集或角色时,接收人可以使用 Performance Insights。
创建自定义策略
使用 https://console.aws.amazon.com/iam/
打开 IAM 控制台。 -
在导航窗格中,选择策略。
-
选择 Create policy (创建策略)。
-
在创建策略页面上,选择“JSON”选项卡。
-
复制并粘贴以下文本,
us-east-1
替换为您 Amazon 所在地区的111122223333
名称和您的客户账号。{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "rds:DescribeDBInstances", "Resource": "*" }, { "Effect": "Allow", "Action": "rds:DescribeDBClusters", "Resource": "*" }, { "Effect": "Allow", "Action": "pi:DescribeDimensionKeys", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:GetDimensionKeyDetails", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:GetResourceMetadata", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:GetResourceMetrics", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:ListAvailableResourceDimensions", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:ListAvailableResourceMetrics", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" } ] }
-
选择查看策略。
-
为策略提供名称并可以选择提供描述,然后选择创建策略。
现在,可以将策略附加到权限集或角色。以下过程假设您已经有一个可用于此目的的用户。
将策略附加到用户
使用 https://console.aws.amazon.com/iam/
打开 IAM 控制台。 -
在导航窗格中,选择 Users。
-
从列表中选择现有用户。
重要
要使用 Performance Insights,请确保除了自定义策略之外,您还有权访问 Amazon DocumentDB。例如,AmazonDocDBReadOnlyAccess预定义策略提供对 Amazon Docdb 的只读访问权限。有关更多信息,请参阅使用策略管理访问权限。
-
在 Summary (摘要) 页上,选择 Add permissions (添加权限)。
-
选择直接附加现有策略。对于 Search,键入策略名称的前几个字符,如下所示。
-
选择策略,然后选择 Next: Review。
-
选择 Add permissions (添加权限)。
为 Performan Amazon KMS ce Insights 配置策略
Performan Amazon KMS key ce Insights 使用加密敏感数据。当您通过 API 或控制台启用 Performance Insights 时,您可以选择以下选项:
-
选择默认值 Amazon 托管式密钥。
Amazon DocumentDB 使用您的新数据库实例。 Amazon 托管式密钥 亚马逊 DocumentDB 会 Amazon 托管式密钥 为您的 Amazon 账户创建一个。您的亚马逊文档数据库 Amazon 账户在每个 Amazon 区域都有不同的 Amazon 托管式密钥 账户。
-
选择客户托管密钥。
如果您指定一个客户托管密钥,则您账户中调用 Performance Insights API 的用户需要在 KMS 密钥具有
kms:Decrypt
和kms:GenerateDataKey
权限。您可以通过 IAM policy 配置这些权限。但是,我们建议您通过 KMS 密钥策略来管理这些权限。有关更多信息,请参阅在 Amazon KMS 中使用密钥策略。
以下示例密钥策略显示了如何将语句添加到 KMS 密钥策略。这些语句可以访问 Performance Insights。根据您的使用方式 Amazon KMS,您可能需要更改一些限制。在将语句添加到您的策略之前,请删除所有注释。
{ "Version" : "2012-10-17", "Id" : "your-policy", "Statement" : [ { //This represents a statement that currently exists in your policy. } ...., //Starting here, add new statement to your policy for Performance Insights. //We recommend that you add one new statement for every RDS/DocumentDB instance { "Sid" : "Allow viewing RDS Performance Insights", "Effect": "Allow", "Principal": { "AWS": [ //One or more principals allowed to access Performance Insights "arn:aws:iam::444455556666:role/Role1" ] }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*", "Condition" :{ "StringEquals" : { //Restrict access to only RDS APIs (including Performance Insights). //Replace *region* with your AWS Region. //For example, specify us-west-2. "kms:ViaService" : "rds.*region*.amazonaws.com" }, "ForAnyValue:StringEquals": { //Restrict access to only data encrypted by Performance Insights. "kms:EncryptionContext:aws:pi:service": "rds", "kms:EncryptionContext:service": "pi", //Restrict access to a specific DocDB instance. //The value is a DbiResourceId. "kms:EncryptionContext:aws:rds:db-id": "db-AAAAABBBBBCCCCDDDDDEEEEE" } } }