Question

Setting TTL on object in Spaces (Not talking about CDN)

Posted December 15, 2019 384 views
DigitalOcean Spaces

Is there a way to set a TTL at upload time on an object? I use Spaces for logging and don’t want to have to manually make API calls to delete data every few weeks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello, Thanks for reaching out to DigitalOcean!

I’m not sure what exactly you mean by TTL value for objects. In general, the TTL value at CDN which will be applied for all the objects. Please refer to below link , which explains on how to setup using CDN:

https://www.digitalocean.com/docs/spaces/how-to/manage-cdn-cache/

However, if you are looking for any object to be deleted after X number of days then you should set the lifecycle rules for Spaces. This can be applied to any folder in your Spaces in which all the objects will be deleted after X days. Here’s our API documentation which will help you in setting lifecycle rules:

https://developers.digitalocean.com/documentation/spaces/#create-bucket-lifecycle

Cheers,
Sri Charan

Submit an Answer