aws s3 将物体移动到冰川中

aws s3 moving objects into glacier

Initial_State:

我有两个 S3 存储桶,分别称为 input_bucketoutput_bucket。每一秒,我的 input_bucket 充满了 csv_files。

我的要求: 我想将 input_bucket(STANDARD_CLASS) 中的 csv_files 移动到 output_bucker(Glacier storage class)

注意:我要搬家csv_files(创建之日起40天)

请为此提出一些解决方案

有多种方法可以实现:

1 使用复制简单且推荐

您无需编写任何代码即可实现。此解决方案会将在 input_bucket 中创建的文件复制到 output_bucket,然后在 40 天后从 input_bucket 中删除它们。

例如

<LifecycleConfiguration>
  <Rule>
    <ID>Transition Rule</ID>
    <Status>Enabled</Status>
    <Expiration>
      <Days>40</Days>
      <StorageClass>S3 Glacier</StorageClass>
    </Expiration>
  </Rule>
</LifecycleConfiguration>

2 使用自定义应用程序 (不推荐)

启用 S3 触发器,然后使用 Lambda 函数创建带有 TTL enabled for 40 days. Dynamodb item should contain the S3 object path. You will also need to enable Dynamodb stream 的 Dynamodb 项目以触发 Lambda 函数,该函数会将对象从 input_bucket 复制到 output_bucket,然后从中删除它来源。这种解决方案很昂贵,不推荐使用。