{"id":22224,"date":"2024-09-23T15:40:12","date_gmt":"2024-09-23T13:40:12","guid":{"rendered":"https:\/\/contabo.com\/blog\/kb\/103000282913-does-contabo-object-storage-support-lifecycle-policies\/"},"modified":"2025-04-10T18:05:23","modified_gmt":"2025-04-10T16:05:23","slug":"103000282913-does-contabo-object-storage-support-lifecycle-policies","status":"publish","type":"kb","link":"https:\/\/contabo.com\/blog\/kb\/103000282913-does-contabo-object-storage-support-lifecycle-policies\/","title":{"rendered":"Does Contabo Object Storage Support Lifecycle Policies?"},"content":{"rendered":"<h4 data-identifyelement=\"490\" dir=\"ltr\"><strong data-identifyelement=\"491\">Does Contabo Object Storage support lifecycle policies?<\/strong><\/h4>\n<p data-identifyelement=\"492\" dir=\"ltr\">Contabo&#8217;s S3 Object Storage supports S3 lifecycle policies that allow you to automatically delete objects after a certain amount of time. This can be useful for pruning old backups or log files.<\/p>\n<p data-identifyelement=\"493\"><br data-identifyelement=\"494\"><\/p>\n<p data-identifyelement=\"495\" dir=\"ltr\">Be careful when setting up lifecycle policies. <strong>They apply to all objects in a bucket and will irreversibly delete them if configured to do so.<\/strong><\/p>\n<p data-identifyelement=\"496\"><strong><br data-identifyelement=\"497\"><\/strong><\/p>\n<h4 data-identifyelement=\"498\"><strong data-identifyelement=\"499\" dir=\"ltr\">How can I setup lifecycle polices with Contabo&#8217;s Object Storage?<\/strong><\/h4>\n<p data-identifyelement=\"500\" dir=\"ltr\">Lifecycle policies can be set through <u data-identifyelement=\"501\"><a href=\"https:\/\/help.contabo.com\/en\/support\/solutions\/articles\/103000305590-what-is-the-aws-cli-tool-\" rel=\"noreferrer nofollow noopener\" target=\"_blank\">aws cli<\/a><\/u>. Make sure to have it set up with your account before you begin.&nbsp;<\/p>\n<p data-identifyelement=\"503\" dir=\"ltr\"><br data-identifyelement=\"504\"><\/p>\n<p data-identifyelement=\"505\" dir=\"ltr\">First, you&#8217;ll need to define the policy as a json file. Here is an example that deletes all files within a bucket after one year:<\/p>\n<p data-identifyelement=\"506\" dir=\"ltr\"><strong data-identifyelement=\"507\"><br data-identifyelement=\"508\"><\/strong><\/p>\n<pre data-identifyelement=\"509\" dir=\"ltr\">{<br data-identifyelement=\"511\">\"Rules\": [<br data-identifyelement=\"512\">{<br data-identifyelement=\"513\">\"ID\": \"DeleteAll365\",<br data-identifyelement=\"514\">\"Status\": \"Enabled\",<br data-identifyelement=\"515\">\"Prefix\": \"\",<br data-identifyelement=\"516\">\"Expiration\": {<br data-identifyelement=\"517\">\"Days\": 365<br data-identifyelement=\"518\">}<br data-identifyelement=\"519\">}<br data-identifyelement=\"520\">]<br data-identifyelement=\"521\">}<\/pre>\n<p data-identifyelement=\"522\" dir=\"ltr\">Customize this snippet and save it as lifecycle-policy.json on your local machine. Then apply it to a bucket with aws cli like this:<\/p>\n<p data-identifyelement=\"525\" dir=\"ltr\"><br data-identifyelement=\"526\"><\/p>\n<pre data-identifyelement=\"527\" dir=\"ltr\">aws --profile eu2 --region default --endpoint-url https:\/\/eu2.contabostorage.com s3api put-bucket-lifecycle-configuration --bucket test --lifecycle-configuration file:\/\/lifecycle-policy.json<\/pre>\n<p data-identifyelement=\"529\" dir=\"ltr\">Replace the profile and endpoint with your object storage and replace test with the actual bucket name. <strong data-identifyelement=\"530\" dir=\"ltr\"><br data-identifyelement=\"531\"><\/strong><\/p>\n<\/p>\n<p><span class=\"ast-load-more active\"><a href=\"https:\/\/help.contabo.com\/en\/support\/solutions\/articles\/103000282913-does-contabo-object-storage-support-lifecycle-policies-\" rel=\"nofollow\">Details&#8230;<\/a> <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Does Contabo Object Storage support lifecycle policies? Contabo&#8217;s S3 Object Storage supports S3 lifecycle policies that allow you to automatically delete objects after a certain amount of time. This can be useful for pruning old backups or log files. Be careful when setting up lifecycle policies. They apply to all objects in a bucket and [&hellip;]<\/p>\n","protected":false},"author":72,"featured_media":0,"template":"","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[2067],"tags":[],"class_list":["post-22224","kb","type-kb","status-publish","hentry","category-kb"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Contabo Web","author_link":"https:\/\/contabo.com\/blog\/author\/julius-nalivaiko\/"},"uagb_comment_info":0,"uagb_excerpt":"Does Contabo Object Storage support lifecycle policies? Contabo&#8217;s S3 Object Storage supports S3 lifecycle policies that allow you to automatically delete objects after a certain amount of time. This can be useful for pruning old backups or log files. Be careful when setting up lifecycle policies. They apply to all objects in a bucket and&hellip;","_links":{"self":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/kb\/22224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/users\/72"}],"version-history":[{"count":1,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/kb\/22224\/revisions"}],"predecessor-version":[{"id":22918,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/kb\/22224\/revisions\/22918"}],"wp:attachment":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media?parent=22224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/categories?post=22224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/tags?post=22224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}