本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
DynamoD CloudWatch B 贡献者见解入门
本节介绍如何在亚马逊 DynamoDB 控制台或 Amazon Command Line Interface () 中使用亚马逊 CloudWatch 贡献者见解。Amazon CLI
在以下示例中,您将使用 DynamoDB 入门教程中定义的 DynamoDB 表。
使用 Contributor Insights(控制台)
-
在控制台左侧的导航窗格中,选择表。
-
选择
Music
表。 -
选择 Monitor(监控)选项卡。
-
选择 “开启投 CloudWatch 稿人见解”。
-
在 Manage Contributor Insights (管理 Contributor Insights) 对话框的 Contributor Insights Status (Conductor Insights 状态) 下方,为
Music
基表和AlbumTitle-index
全局二级索引选择 Enabled (已启用)。然后,选择确认。如果操作失败,请参阅亚马逊 DynamoDB API 参考DescribeContributorInsights FailureException中的可能原因。
-
选择 View in DynamoDB (在 DynamoDB 中查看)。
-
Contributor Insights 图表现在可以在
Music
表的 Contributor Insights 选项卡查看。
创建 CloudWatch 警报
按照以下步骤创建 CloudWatch 警报,并在任何分区键消耗超过 50,000 ConsumedThroughputUnits时收到通知。
登录 Amazon Web Services Management Console 并打开 CloudWatch 控制台,网址为 https://console.aws.amazon.com/cloudwatch/
-
在控制台左侧的导航窗格中,选择 Contributor Insights。
-
选择 DynamoDB-pkc-M ContributorInsights usic 规则。
-
选择 Actions (操作) 下拉菜单。
-
选择 View in metrics (查看指标)。
-
选择 Max Contributor Value (最大贡献者值)。
注意
仅
Max Contributor Value
和Maximum
返回有用的统计信息。此列表中的其他统计信息不返回有意义的值。 -
在 Actions (操作) 列选择 Create Alarm (创建告警)。
-
为阈值输入值 50000,然后选择 Next (下一步)。
-
有关如何为 CloudWatch 警报配置通知的详细信息,请参阅使用 Amazon 警报。
使用 Contributor Insights(Amazon CLI)
-
在基表上
Music
启用 DynamoDB 的 CloudWatch 贡献者见解。aws dynamodb update-contributor-insights --table-name Music --contributor-insights-action=ENABLE
-
在
AlbumTitle-index
全局二级索引启用 Contributor Insights for DynamoDB。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
-
在全
AlbumTitle-index
局二级索引上禁用 DynamoDB 的 CloudWatch 贡献者见解。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