Richard Reveley
Richard Reveley

Reputation: 21

Does lifecycle depend on the time an object was deleted or created?

I have this lifecyle set on my Google Cloud Storage

  "action": {"type": "Delete"},
  "condition": {"age": 7, "isLive": false}

If I remove a file will the lifecycle delete event occur 7 days later or will it apply immediately if the file is already over 7 days old?

When I use gsutil ls -a it seems like the version doesn't change when I remove a file which makes me think that it will get treated by lifecycle as if it is already over 7 days old.

If that is the case how can I have my files deleted 7 days after they are removed?

Upvotes: 2

Views: 1086

Answers (1)

Brandon Yarbrough
Brandon Yarbrough

Reputation: 38389

If you remove a file, it will be deleted immediately. Nothing will happen 7 days later.

If you have an existing object in a bucket with that lifecycle policy, it will be deleted by GCS at some point after it reaches 7 days old. There is no guarantee that it will be deleted immediately, but it will usually happen in less than a day.

Upvotes: 2

Related Questions