Use S3 lifecycle policy to create a recycle bin

1

I am thinking to create a recycle bin mechanism for a versioned s3 bucket to prevent accidental deletion and modification of authorized users. The idea is 1) keep most recent 5 non-current revisions for 1 day; 2) any non-current version older than 2 days will be deleted.

The policies look like:

{
    "Rules": [
        {
            "ID": "Recyclebin_Part1",
            "Filter": {},
            "Status": "Enabled",
            "NoncurrentVersionExpiration": {
                "NoncurrentDays": 1,
                "NewerNoncurrentVersions": 5
            }
        },
        {
            "ID": "RecycleBin_Part2",
            "Filter": {},
            "Status": "Enabled",
            "NoncurrentVersionExpiration": {
                "NoncurrentDays": 2
            }
        }
    ]
}

However, looks like the second rule RecycleBin_Part2 was never applied. By checking at the object versions, there are always 5 non-current versions, even after a couple of days.

I could be wrong but does the first policy always win if both policies target (whole bucket) on the same scope and perform a same operation (expire objects) on the objects?

Is there a better way to implement this idea? A script to scan and purge non-current objects might not be a scalable option for buckets with millions of objects.

Thanks!

JM
질문됨 2년 전154회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠