本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Contributor Insights for CloudWatch 入门DynamoDB
本节介绍如何将 Amazon CloudWatch Contributor Insights 与 Amazon DynamoDB 控制台或 AWS Command Line Interface (AWS CLI) 结合使用。
在以下示例中,您将使用在 DynamoDB 入门教程中定义的 DynamoDB 表。
使用 Contributor Insights(控制台)
-
登录 AWS 管理控制台并通过以下网址打开 DynamoDB 控制台:https://console.amazonaws.cn/dynamodb/
。 -
在控制台左侧的导航窗格中,选择 Tables (表)。
-
选择
Music
表。 -
选择 Contributor Insights 选项卡。
-
选择 Manage Contributor Insights。
-
在 Manage Contributor Insights 对话框的 Contributor Insights Status 下,为 基表和 全局二级索引选择
Music
EnabledAlbumTitle-index
。然后选择 Confirm (确认)。如果操作失败,请参阅 DescribeContributorInsights中的 FailureExceptionAmazon DynamoDB API Reference(出于可能原因)。
-
选择在 DynamoDB 中查看。
-
Contributor Insights 图表现在显示在 表的 Contributor Insights
Music
选项卡上。
创建 CloudWatch 警报
请按照以下步骤创建 CloudWatch 警报,并在任何分区键使用超过 50,000 ConsumedThroughputUnits 时收到通知。
-
登录 AWS 管理控制台,并通过以下网址打开 CloudWatch 控制台:https://console.aws.amazon.com/cloudwatch/
-
在控制台左侧的导航窗格中,选择 Contributor Insights。
-
选择 DynamoDBContributorInsights-PKC-Music 规则。
-
选择 Actions (操作) 下拉菜单。
-
选择 View in metrics (查看指标)。
-
选择 Max Contributor Value (最大贡献者值)。
注意 仅
Max Contributor Value
和Maximum
返回有用的统计信息。此列表中的其他统计信息不返回有意义的值。 -
在 Actions (操作) 列上,选择 Create Alarm (创建警报)。
-
为 threshold (阈值) 输入值 50000,然后选择 Next (下一步)。
-
有关如何配置警报通知的详细信息,请参阅使用 Amazon CloudWatch 警报。
使用 Contributor Insights (AWS CLI)
-
在 CloudWatch 基表上启用 DynamoDB Contributor Insights for
Music
。aws dynamodb update-contributor-insights --table-name Music --contributor-insights-action=ENABLE
-
在 DynamoDB 全局二级索引上启用 Contributor Insights for
AlbumTitle-index
。aws dynamodb update-contributor-insights --table-name Music --index-name AlbumTitle-index --contributor-insights-action=ENABLE
-
获取
Music
表及其所有索引的状态和规则。aws dynamodb describe-contributor-insights --table-name Music
-
在 CloudWatch 全局二级索引上禁用 DynamoDB Contributor Insights for
AlbumTitle-index
。aws dynamodb update-contributor-insights --table-name Music --index-name AlbumTitle-index --contributor-insights-action=DISABLE
-
获取
Music
表及其所有索引的状态。aws dynamodb list-contributor-insights --table-name Music