CloudWatch Contributor Insights for DynamoDB 入门
本节介绍如何将 Amazon CloudWatch Contributor Insights 与 Amazon DynamoDB 控制台或 Amazon Command Line Interface (Amazon CLI) 一起使用。
在以下示例中,您将使用 DynamoDB 入门教程中定义的 DynamoDB 表。
使用 Contributor Insights(控制台)
在控制台中使用 Contributor Insights
登录 Amazon Web Services Management Console,并打开 DynamoDB 控制台:https://console.aws.amazon.com/dynamodb/
。 -
在控制台左侧的导航窗格中,选择表。
-
选择
Music
表。 -
选择监控选项卡。
-
选择开启 CloudWatch Contributor Insights。
-
在管理 Contributor Insights 对话框的 Conductor Insights 状态下方,为
Music
基表和AlbumTitle-index
全局二级索引选择已启用。然后,选择确认。如果操作失败,请参阅 Amazon DynamoDB API 参考中的 DescribeContributorInsights FailureException 了解可能的原因。
-
选择在 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。
-
选择 DynamoDBContributorInsights-PKC-Music 规则。
-
选择操作下拉菜单。
-
选择在指标中查看。
-
选择最大贡献者值。
注意
仅
Max Contributor Value
和Maximum
返回有用的统计信息。此列表中的其他统计信息不返回有意义的值。 -
在操作列选择创建告警。
-
为阈值输入值 50000,然后选择下一步。
-
有关如何为警报配置通知的详细信息,请参阅使用 Amazon CloudWatch 警报。
使用 Contributor Insights (Amazon CLI)
在 Amazon CLI 中使用 Contributor Insights
-
在
Music
基表启用 CloudWatch Contributor Insights for DynamoDB。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
全局二级索引禁用 CloudWatch Contributor Insights for DynamoDB。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