Getting started with CloudWatch contributor insights for DynamoDB - Amazon DynamoDB

Getting started with CloudWatch contributor insights for DynamoDB

This section describes how to use Amazon CloudWatch Contributor Insights with the Amazon DynamoDB console or the AWS Command Line Interface (AWS CLI).

In the following examples, you use the DynamoDB table that is defined in the Getting started with DynamoDB tutorial.

Using contributor insights (console)

  1. Sign in to the AWS Management Console and open the DynamoDB console at https://console.aws.amazon.com/dynamodb/.

  2. In the navigation pane on the left side of the console, choose Tables.

  3. Choose the Music table.

  4. Choose the Monitor tab.

  5. Choose Turn on CloudWatch Contributor Insights.

    
                        Console screenshot showing monitor tab and
                            button.
  6. In the Manage Contributor Insights dialog box, under Contributor Insights Status, choose Enabled for both the Music base table and the AlbumTitle-index global secondary index. Then choose Confirm.

    
                        Console screenshot showing Contributor Insights status list
                            options.

    If the operation fails, see DescribeContributorInsights FailureException in the Amazon DynamoDB API Reference for possible reasons.

  7. Choose View in DynamoDB.

    
                        Console screenshot showing View in DynamoDB button in the
                            Contributor Insights settings.
  8. The Contributor Insights graphs are now visible on the Contributor Insights tab for the Music table.

    
                        Console screenshot showing Contributor Insights tab with several
                            graphs for the music table.

Creating CloudWatch alarms

Follow these steps to create a CloudWatch alarm and be notified when any partition key consumes more than 50,000 ConsumedThroughputUnits.

  1. Sign in to the AWS Management Console and open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/

  2. In the navigation pane on the left side of the console, choose Contributor Insights.

  3. Choose the DynamoDBContributorInsights-PKC-Music rule.

  4. Choose the Actions drop down.

  5. Choose View in metrics.

  6. Choose Max Contributor Value.

    Note

    Only Max Contributor Value and Maximum return useful statistics. The other statistics in this list don't return meaningful values.

    
                        Console screenshot showing Contributor Insights tab and
                            button.
  7. On the Actions column, Choose Create Alarm.

    
                        Console screenshot showing Contributor Insights status list
                            options.
  8. Enter a value of 50000 for threshold and choose Next.

    
                        Console screenshot showing Contributor Insights tab and
                            button.
  9. See Using Amazon CloudWatch alarms for details on how to configure the notification for the alarm.

Using contributor insights (AWS CLI)

  1. Enable CloudWatch Contributor Insights for DynamoDB on the Music base table.

    aws dynamodb update-contributor-insights --table-name Music --contributor-insights-action=ENABLE
  2. Enable Contributor Insights for DynamoDB on the AlbumTitle-index global secondary index.

    aws dynamodb update-contributor-insights --table-name Music --index-name AlbumTitle-index --contributor-insights-action=ENABLE
  3. Get the status and rules for the Music table and all its indexes.

    aws dynamodb describe-contributor-insights --table-name Music
  4. Disable CloudWatch Contributor Insights for DynamoDB on the AlbumTitle-index global secondary index.

    aws dynamodb update-contributor-insights --table-name Music --index-name AlbumTitle-index --contributor-insights-action=DISABLE
  5. Get the status of the Music table and all its indexes.

    aws dynamodb list-contributor-insights --table-name Music