0

Is there anyway to see how many times the provisioned throughput was decreased within the same day (UTC) in a DynamoDB table?

When increasing the provisioned throughput I am always afraid not to be able to decrease it afterward within the same day, since one cannot decrease the provisioned throughput in a DynamoDB table more than 4 times within the same day (UTC).

The monitoring graph's precision does not seem to be enough to see all previous provisioned throughput changes that happened during the same day. E.g. the provisioned throughput was decreased 4 times in this table, but one cannot see it on the graph:

enter image description here

enter image description here

And obviously Amazon does not give any warning in case we increase provisioned throughput while not being allowed to decrease it back.

1

The number of decreases is returned in a DescribeTable result as part of the ProvisionedThroughputDescription. It seems the DynamoDB console doesn't display this though and only shows the "Last Decrease Time".

0

If this can help anyone, I wrote a Python function to see how many times the provisioned throughput was decreased within the same day for each DynamoDB table:

import boto
import operator

MY_ACCESS_KEY_ID = 'copy your access key ID here'
MY_SECRET_ACCESS_KEY = 'copy your secret access key here'

def get_number_of_decreases_today():
    '''
    Scan all DynamoDB tables, and returns a dictionary with table name as key, NumberOfDecreasesToday as value.
    '''
    dynamodb_conn = boto.connect_dynamodb(aws_access_key_id=MY_ACCESS_KEY_ID, aws_secret_access_key=MY_SECRET_ACCESS_KEY)
    table_names = dynamodb_conn.list_tables()
    table_number_of_decreases_today = {}
    for table_name in table_names:
        dynamodb_table_description = dynamodb_conn.describe_table(table_name)
        table_number_of_decreases_today[table_name] = dynamodb_table_description['Table']['ProvisionedThroughput']['NumberOfDecreasesToday']
        #print('NumberOfDecreasesToday is {0} for table {1}'.format(table_number_of_decreases_today[table_name], table_name))
    return table_number_of_decreases_today

def main():
    table_number_of_decreases_today = get_number_of_decreases_today()

    # Print table names and NumberOfDecreasesToday with alphabetically ordered table names
    for key, value in sorted(table_number_of_decreases_today.items(), key=operator.itemgetter(0)):
        print('{0}\t{1}'.format(key,value))    

    # Print table names by ascending NumberOfDecreasesToday
    for key, value in sorted(table_number_of_decreases_today.iteritems(), key=lambda (k,v): (v,k)):
        print('{0}\t{1}'.format(key, value))

if __name__ == "__main__":
    main()
    #cProfile.run('main()') # if you want to do some profiling

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.