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

查看:21
本文介绍了我可以获得 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天全站免登陆