我可以获取DynamoDB或DynamoDB2表的实际写入容量的值吗 [英] Can I get value of actual write capacity of DynamoDB or DynamoDB2 table

查看:87
本文介绍了我可以获取DynamoDB或DynamoDB2表的实际写入容量的值吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我访问现有的DynamoDB

Suppose I access an existing DynamoDB

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

或DynamoDB2

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?

推荐答案

类似的东西应该可以工作:

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'})

这应该是数据点列表。您应该对列表中的所有总和求平均值,然后将该数字除以300,即句点。

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.

这篇关于我可以获取DynamoDB或DynamoDB2表的实际写入容量的值吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆