Lưu ý khi sử dụng S3 lifecycle rule

Lưu ý khi sử dụng S3 lifecycle rule

Share Everywhere

Table of contents

Yêu cầu:

Tạo một rule để làm object trong bucket bị delete sau 1 ngày

Thực trạng:

Hiện tại chưa thể trong 1 ngày đã delete hoàn toàn (lý do: days thực hiện action phải là int từ 1). Tuy nhiên, có thể khiến cho object bị mark as delete, không hiển thị với user nữa sau 1 ngày, đến ngày thứ 2 là xóa hoàn toàn 

Giải pháp: 

{
  "Rules": [
    {
      "Expiration": {
        "Days": 1
      },
      "ID": "delete-expiration-itemư",
      "Filter": {
        "Prefix": "tmp/tmp_001/"
      },
      "Status": "Enabled",
      "NoncurrentVersionExpiration": {
        "NoncurrentDays": 1
      },
      "AbortIncompleteMultipartUpload": {
        "DaysAfterInitiation": 1
      }
    }
  ]
}

Lưu ý:

1. “Prefix”: “tmp/tmp_001/” mà thành viết thành “Prefix”: “/tmp/tmp_001/” thì có để năm kia cũng k xóa!

2. Với lifecycle rule này, sẽ cần có 4 ngày để 1 object xóa hoàn toàn (lifecycle lần đầu chạy) vì sẽ cần 48 giờ để lifecycle rule mới tạo valid và chạy. Từ lần chạy thứ 2 thì chỉ cần 2 ngày thôi.

3. Có cần phải enable versioning không: Với rule trên thì đang là có enable versioning.

Tuy nhiên, you can use lifecycle rules for S3 buckets regardless of whether they are enabled for versioning or not.

Bạn thấy bài viết này như thế nào?
0 reactions

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Bài viết liên quan

Khám phá FinOps

Khám phá FinOps - công nghệ đám mây

Nhiều doanh nghiệp ngày nay lựa chọn chuyển sang công nghệ đám mây với hi vọng đạt được lợi thế cạnh tranh so với đối thủ nhờ tiềm năng về hiệu quả cao và tiết kiệm chi phí hơn của công nghệ này.
Microservices Roadmap

Microservices Roadmap

- Kafka, RabbitMQ, Amazon SQS: Efficient and reliable message brokers for seamless communication between microservices.
The Data Analyst Roadmap

The Data Analyst Roadmap

**Database Knowledge**: Gain proficiency in working with databases like MySQL, PostgreSQL, or MongoDB.
Architectural patterns in software design

Architectural patterns in software design

Choose the architecture that aligns with your application's unique needs and goals. Each pattern offers a tailored approach to elevate your software system!
Exploring the Technological Marvel Behind Netflix

Exploring the Technological Marvel Behind Netflix

Ever wondered about the tech wizardry that powers your binge-watching adventures on Netflix?