[英]How to rate limit scan to AWS DynamoDB for AWS CLI?
I have created the following query to query my table : 我创建了以下查询来查询我的表:
aws dynamodb scan --table-name TableName --scan-filter '{
"attributeName" : {
"AttributeValueList" : [ {"S" : "StringToQuery"}],
"ComparisonOperator" : "CONTAINS"
}
}'
This is causing a spike in read capacity for that table, which will probably lead to throttling of customer requests. 这导致该表的读取容量激增,这可能会导致对客户请求的限制。 I couldn't find any command line option to limit the rate in https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html , but I did find a java script with rate limit : https://aws.amazon.com/blogs/developer/rate-limited-scans-in-amazon-dynamodb/
我在https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html找不到任何限制速率的命令行选项,但我找到了一个速率限制的java脚本: https ://aws.amazon.com/blogs/developer/rate-limited-scans-in-amazon-dynamodb/
Is there any way to do it from AWS CLI? 有没有办法从AWS CLI做到这一点?
You can disable pagination and manually make the paginated calls with a bash loop. 您可以禁用分页并使用bash循环手动进行分页调用。 This way you can delay a certain amount based on the time the previous call took and the consumed read capacity.
这样,您可以根据上一次调用所花费的时间和消耗的读取容量来延迟一定的数量。
Went ahead with creating a new index over a value which i knew was almost always "Y", like isActive, and added a filter on top of the query. 继续创建一个新的索引,我知道这个值几乎总是“Y”,就像isActive一样,并在查询之上添加了一个过滤器。 Since it was a new index, it didn't affect existing index capacity.
由于它是一个新的索引,它不会影响现有的索引容量。
Answer by cementblocks would reduce the RCU consumed too, but I needed a guarantee that customers would not be impacted. 通过Cementblocks回答也会减少RCU消耗,但我需要保证客户不会受到影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.