Question

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

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.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.