Can I get value of actual write capacity of DynamoDB or DynamoDB2 table

孤街浪徒 提交于 2019-12-06 06:48:41

问题


Suppose I access an existing DynamoDB

import boto
conn = boto.connect_dynamodb(...)
table = conn.get_table(tableName)

or a DynamoDB2

import boto
from boto.dynamodb2.layer1 import DynamoDBConnection
from boto.dynamodb2.table import Table
conn = DynamoDBConnection(...)
table = Table(tableName, connection=conn)

table. I want to know how much data was written to it right before I accessed it. So I don't want the provisioned write throughput value but the actual throughput. How can I get this info?


回答1:


Something like this should work:

import boto.ec2.cloudwatch
import datetime

end = datetime.datetime.utcnow()
start = end - datetime.timedelta(minutes=5)
c = boto.ec2.cloudwatch.connect_to_region('us-east-1')
data = c.get_metric_statistics(period=60, start_time=start, end_time=end,   
         metric_name='ConsumedWriteCapacityUnits', namespace='AWS/DynamoDB',
         statistics=['Sum'],dimensions={'TableName': 'mytable'})

This should a list of data points. You should average all of the sums in the list and then divide that number by 300, the period.



来源:https://stackoverflow.com/questions/24293803/can-i-get-value-of-actual-write-capacity-of-dynamodb-or-dynamodb2-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!