Search code examples
pythonamazon-web-servicesaws-lambdaamazon-dynamodbboto3

Get tables whose wcu/rcu 200 or 200+ using boto3


Is there any way to get table wcu/rcu value using boto3, I have 200+ tables from which I need to list out tables whose wcu/rcu values are set to 200 or 200+, so looking for solution using boto3 if i can get these tables, as some tables are on demand and some have been provisioned throughput enable. I really don't want to do this manually, Code I tried is:

import boto3
dynamodb = boto3.resource("dynamodb")
table = dynamodb.Table("table-name")
billing_mode = table.billing_mode_summary
print(billing_mode)

but this doesn't provided desired output. Is there any way to do this.


Solution

  • Is there any way to get table wcu/rcu value using boto3

    You can use dynamodb.describe_table like this:

    dynamodb = boto3.client('dynamodb')
    ...
    table_info = dynamodb.describe_table(TableName="table-name")['Table']
    wcu = table_info['ProvisionedThroughput']['WriteCapacityUnits']
    rcu = table_info['ProvisionedThroughput']['ReadCapacityUnits']
    ... Your conditions to verify the values...
    

    For more details check DynamoDB.Client.describe_table