You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何利用AWS生命周期管理策略仅将S3 Standard存储桶中大于100MB的对象转存至AWS Glacier

S3 Lifecycle Policy Configuration for Transitioning Large Objects to AWS Glacier

Got it, let's walk through exactly how to set up the lifecycle policies you're asking for. I'll break this down into two clear scenarios based on your requirements.

1. Transition Objects >100MB AND Older Than 30 Days to AWS Glacier

Using the S3 Console

  • Head to the AWS S3 Console and select your target Standard storage bucket.
  • Navigate to the Management tab, then click Lifecycle rules > Create lifecycle rule.
  • Give your rule a descriptive name (e.g., "Large-Old-Objects-to-Glacier") and leave the "Apply to all objects in the bucket" checkbox unchecked.
  • Under Filter and scope, select Specify a filter > Object size, then enter 104857600 in the "Greater than (bytes)" field (this equals 100MB).
  • Move to the Transition section:
    • Click Add transition > Transition to Amazon S3 Glacier Flexible Retrieval (or your preferred Glacier storage class).
    • Set the "Days after object creation" field to 30.
  • Review all settings and click Create rule.

Using JSON Configuration

If you prefer to define the rule via JSON (useful for automation or version control), here's the full policy:

{
  "Rules": [
    {
      "ID": "Large-Old-Objects-to-Glacier",
      "Filter": {
        "SizeGreaterThan": 104857600
      },
      "Status": "Enabled",
      "Transitions": [
        {
          "Days": 30,
          "StorageClass": "GLACIER"
        }
      ]
    }
  ]
}
  • SizeGreaterThan: Ensures only objects larger than 100MB (104857600 bytes) are targeted.
  • Days: Specifies the object must be at least 30 days old before transition.
  • StorageClass: Use GLACIER for Glacier Flexible Retrieval, or DEEP_ARCHIVE if you need lower-cost long-term storage (note retrieval times differ between these classes).

2. Transition ONLY Objects >100MB to AWS Glacier (No Age Restriction)

If you want to move large objects to Glacier immediately after they're uploaded (no waiting period), follow these steps:

Using the S3 Console

  • Repeat the first few steps above: Create a new lifecycle rule, name it (e.g., "Large-Objects-to-Glacier-Immediate"), and set the object size filter to 104857600 bytes.
  • In the Transition section:
    • Select your target Glacier storage class, then set "Days after object creation" to 0. This tells S3 to transition the object as soon as it's created.
  • Save the rule.

Using JSON Configuration

Here's the corresponding JSON policy:

{
  "Rules": [
    {
      "ID": "Large-Objects-to-Glacier-Immediate",
      "Filter": {
        "SizeGreaterThan": 104857600
      },
      "Status": "Enabled",
      "Transitions": [
        {
          "Days": 0,
          "StorageClass": "GLACIER"
        }
      ]
    }
  ]
}
  • Setting Days: 0 skips the age check, so any object over 100MB will be moved to Glacier right after upload.

Key Notes

  • Always double-check the byte value: 100MB = 100 * 1024 * 1024 = 104857600 bytes. Using the wrong value will lead to incorrect filtering.
  • Test your rule with a small set of test objects first to ensure it behaves as expected before applying it to your full 50TB bucket.
  • Remember that transitioning objects to Glacier incurs transition costs and retrieval costs if you need to access the data later.

内容的提问来源于stack exchange,提问作者Nitin Kumar

火山引擎 最新活动