自动删除来自DynamoDB表和S3数据数据、DynamoDB

2023-09-11 09:57:57 作者:听这一季雨落

我已经开始探索 DynamoDB S3 最近。

I have started exploring DynamoDB and S3 recently.

我通过开发指南去了,我很好奇,是否有什么方法可以删除基于某些条件的DynamoDB表或S3存储数据?

I went through the Developer Guide, I was curious that Is there any way to delete data from DynamoDB Table or S3 bucket based on some condition ?

下面的条件可能是时间/空间。 就像我希望过一段时间后,以删除 DynamoDB / S3 数据(比如200天),或如果超过如2 GB的一些限制。

The conditions here may be time/space. Like I want to delete data from DynamoDB/S3 after some time(say 200 days) or if it exceeds some limit like 2 GB.

推荐答案

有关S3,可以使用的 lifecyles 。对于DynamoDB,不存在这样的规则。

For S3, it is possible to delete after a given time using lifecyles. For DynamoDB, there is no such a rule.

有关两者,也没有直接的方法的基础上作出的空间来清洁。

For both, there is no direct way to clean based on the space taken.

在实践中,可以使用 AWS LAMBDA 做很容易,并的S3和DynamoDB事件,但它需要执行它:每当一个新的条目被添加(或每n次)由S3- / DynDB-事件通知,计算尺寸并清理什么应清洗

In practice, it is possible to do it "quite easily" using AWS Lambda and the S3 and DynamoDB events, but it requires to implement it: Each time a new entry is added (or each n times) notified by S3-/DynDB- events, compute the size and clean what should be cleaned.