[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThis guide outlines how to set retention periods for Google Distributed Cloud (GDC) air-gapped appliance storage buckets, which prevents object deletion for a specified number of days.\u003c/p\u003e\n"],["\u003cp\u003eObject locking, which is necessary for enabling retention periods, must be enabled during bucket creation and cannot be turned on or off afterward, but the retention period itself can be modified.\u003c/p\u003e\n"],["\u003cp\u003eTo modify the retention period, you can update the \u003ccode\u003eBucket.spec.bucketPolicy.lockingPolicy.defaultObjectRetentionDays\u003c/code\u003e field within the Bucket resource.\u003c/p\u003e\n"],["\u003cp\u003eUpdates to the retention period only affect new objects added to the bucket, leaving the retention period of pre-existing objects unchanged.\u003c/p\u003e\n"],["\u003cp\u003eWhen object locking is enabled and an object is overwritten, it creates a new version of the object, and both object versions are retrievable.\u003c/p\u003e\n"]]],[],null,["# Set bucket retention periods\n\nThis page guides you through how to set retention periods for storage buckets within Google Distributed Cloud (GDC) air-gapped appliance environments. It covers the prerequisites and the steps for defining the length of time that data must be retained within a storage bucket. This information helps you meet your regulatory and data management requirements.\n\nThis page is for audiences such as IT administrators within the infrastructure operator group or developers within the application operator group who are responsible for configuring and managing storage bucket settings in GDC air-gapped environments.\n\nBy default, you can delete objects at any time. Enable object locking\nwith a retention period to prevent all objects in the bucket from deletion for\nthe specified number of days. You cannot delete a bucket until you\ndelete all objects after the retention period.\n\nYou must enable object locking when creating the bucket. You cannot enable or\ndisable object locking after you create a bucket. However, you can modify the\ndefault object retention period.\n\nYou can create a bucket with or without enabling object locking. If you've\nenabled object locking, specifying a default retention period is optional.\n\nTo modify the retention period, update the\n`Bucket.spec.bucketPolicy.lockingPolicy.defaultObjectRetentionDays` field in the\n[Bucket resource](/distributed-cloud/hosted/docs/latest/appliance/apis/storage-krm-api).\n\nThe following is an example of updating the field in the Bucket resource: \n\n apiVersion: object.gdc.goog/v1alpha1\n kind: Bucket\n metadata:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eBUCKET_NAME\u003c/span\u003e\u003c/var\u003e\n namespace: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE_NAME\u003c/span\u003e\u003c/var\u003e\n spec:\n description: \"This bucket has a default retention period specified.\"\n storageClass: Standard\n bucketPolicy :\n lockingPolicy :\n defaultObjectRetentionDays: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eRETENTION_DAY_COUNT\u003c/span\u003e\u003c/var\u003e\n ---\n apiVersion: object.gdc.goog/v1alpha1\n kind: Bucket\n metadata:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eBUCKET_NAME\u003c/span\u003e\u003c/var\u003e\n namespace: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE_NAME\u003c/span\u003e\u003c/var\u003e\n spec:\n description: \"This would enable object locking but not specify a default retention period.\"\n storageClass: Standard\n bucketPolicy :\n lockingPolicy :\n ---\n apiVersion: object.gdc.goog/v1alpha1\n kind: Bucket\n metadata:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eBUCKET_NAME\u003c/span\u003e\u003c/var\u003e\n namespace: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE_NAME\u003c/span\u003e\u003c/var\u003e\n spec:\n description: \"This bucket does not have locking or retention enabled.\"\n storageClass: Standard\n\nAny updates to the retention period apply to objects created in the bucket after\nthe update. For pre-existing objects, the retention period does not change.\n\nWhen you've enabled object locking, if you attempt to overwrite an object, you add a new\nversion of the object. You can retrieve both object versions.\nFor details on how to list object versions, see `ListObjectVersions` from the\nAmazon Web Services documentation:\n\u003chttps://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectVersions.html\u003e\n\nTo create a write-once, read-many (WORM) bucket, refer to the\n[WORM Bucket](#worm_bucket) section."]]