Vault snapshots automation "retain" parameter

should the “retain” parameter in snapshots-auto endpoint delete snapshots ?

  • retain (integer: 1) - How many snapshots are to be kept; when writing a snapshot, if there are more snapshots already stored than this number, the oldest ones will be deleted.

I was trying to retain only 3 snapshots in an s3 bucket , but this number was exceeded and none of the old snapshots where deleted ?
is that an expected behavior ?

Vault is not going to delete older backups from S3. For that you have to setup a S3 lifecycle rule in that folder. While in the folder, click Management and “Create lifecycle rule”.

1 Like

We have an internal issue that suggests that retain with S3 doesn’t work properly when path_prefix=/.

I recommend when you have issues with Enterprise features you go through the usual support channels, as they aren’t tracked in our public Github repo.

1 Like

Thank you @ncabatoff , I’ll be making contact with vault enterprise support

is this issue fixed in the latest versions? Do we still need to use the S3 lifecycle rule ? or we can use the retain parameter?

no lifecycle rule is needed, retain parameter works, I was adding slash (‘/’) at the beginning of the path_prefix , removing that fixed my issue.