本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
本節說明如何將 Amazon CloudWatch Contributor Insights 與 Amazon DynamoDB 主控台或 AWS Command Line Interface () 搭配使用AWS CLI。
在下列範例中,您會用到 DynamoDB 入門教學課程中定義的資料表。
使用 Contributor Insights (主控台)
在主控台中使用貢獻者洞察
登入 AWS Management Console 並在 開啟 DynamoDB 主控台https://console.aws.amazon.com/dynamodb/
。 -
在主控台左側的導覽窗格中,選擇 Tables (資料表)。
-
選擇
Music
資料表。 -
選擇 監控 索引標籤。
-
選擇開啟 CloudWatch 貢獻者洞察 。
-
進入 Manage Contributor Insights (管理 Contributor Insights) 對話方塊,在 Contributor Insights Status (Contributor Insights 狀態) 下,為
Music
基礎資料表和AlbumTitle-index
全域次要索引選擇 Enabled (啟用)。然後選擇 Confirm (確認)。如果操作失敗,請參閱 DescribeContributorInsights FailureException Amazon DynamoDB API參考中的 了解可能的原因。
-
選擇 View in DynamoDB (在 DynamoDB 中檢視)。
-
Contributor Insights 圖表現在可以在
Music
資料表的 Contributor Insights 索引標籤找到。
建立 CloudWatch 警示
請依照下列步驟建立 CloudWatch 警示,並在任何分割區金鑰耗用超過 50,000 時收到通知ConsumedThroughputUnits。
登入 AWS Management Console 並在 開啟 CloudWatch 主控台 https://console.aws.amazon.com/cloudwatch/
-
在主控台左側的導覽窗格中,選擇 Contributor Insights。
-
選擇 D ynamoDBContributorInsights-PKC-Music 規則。
-
選擇 Actions (動作) 下拉式功能表。
-
選擇 View in metrics (在指標中檢視)。
-
選擇 Max Contributor Value (作者值上限)。
注意
只有
Max Contributor Value
和Maximum
會傳回有用的統計數字。此清單中的其他統計數字不會傳回有意義的值。 -
在 Actions (動作) 欄中,選擇 Create Alarm (建立警示)。
-
輸入值 50000 做為閾值,然後選擇 Next (下一步)。
-
如需如何設定 CloudWatch 警示通知的詳細資訊,請參閱使用 Amazon 警示。
使用 Contributor Insights (AWS CLI)
若要在 中使用貢獻者洞察 AWS CLI
-
在
Music
基礎資料表上啟用 DynamoDB 的 CloudWatch Contributor Insights。aws dynamodb update-contributor-insights --table-name Music --contributor-insights-action=ENABLE
-
在
AlbumTitle-index
全域次要索引上啟用 DynamoDB 專用 Contributor Insights。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 Contributor Insights。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