How to apply s3 lifecycle rule except one prefix/folder

Viewed 85

I have this rule apply to all the objects in s3 but how can I apply it to all object except one prefix app/

lifecycle_rule = [
    {
      id                                     = "log1"
      enabled                                = true
      abort_incomplete_multipart_upload_days = 7

      noncurrent_version_transition = [
        {
          days          = 30
          storage_class = "STANDARD_IA"
        },
        {
          days          = 60
          storage_class = "ONEZONE_IA"
        },
        {
          days          = 90
          storage_class = "GLACIER"
        },
      ]

      noncurrent_version_expiration = {
        days = 300
      }
    }
]

Basically, I want all objects to go to GLACIER after 90 days except app/

1 Answers

You have to create rules for all prefixes, except /app. There are no regular expressions, so you can't create rules of type "all prefixes which do not match /app".

Related