[[["이해하기 쉬움","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-05(UTC)"],[],[],null,["# Set object lifecycle policy for storage buckets\n\nThis page shows you how to set object lifecycle policy for Google Distributed Cloud (GDC) air-gapped storage buckets.\n\nBefore you begin\n----------------\n\nA project namespace manages bucket resources in the Management API server. You\nmust have a [project](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/project-management) to work with buckets and objects.\n\nYou must also have the appropriate bucket permissions to perform the following\noperation. See [Grant bucket access](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/grant-obtain-storage-access#grant_bucket_access).\n\nSet object lifecycle policy on bucket\n-------------------------------------\n\nYou can use object lifecycle policy to automatically manage objects in\nyour buckets. This helps you store data more efficiently throughout its\nlifespan. A lifecycle configuration is a list of rules to expire a\ngroup of objects based on certain matching criteria.\n\nYou can create a bucket with or without object lifecycle policy. And you can apply new, update existing or remove existing lifecycle policy\nafter the bucket is created.\n\nFor unversioned buckets, expiration means permanently removing the object\nasynchronously.\n\nFor versioned buckets, if the current object version is not a deletion marker,\nexpiration makes the current version noncurrent and then adds a delete marker to the current version.\n\nTo set and modify the object lifecycle policy,\nupdate the `Bucket.spec.bucketPolicy.lifecyclePolicy` field. \n\n### CLI\n\n\nThe following are few examples of bucket resources with different object\nlifecycle policy configured: \n\n apiVersion: object.gdc.goog/v1\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: \"Bucket with lifecycle rule to expire all objects after 2000 days\"\n storageClass: Standard\n bucketPolicy:\n lifecyclePolicy:\n enable: true\n lifecycleRules:\n - expiration:\n days: 2000\n id: expire-all-after-2000-days\n status: Enabled\n ----------\n apiVersion: object.gdc.goog/v1\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: \"Bucket with lifecycle rule to expire objects having name start with abc after 500 days\"\n storageClass: Standard\n bucketPolicy:\n lifecyclePolicy:\n enable: true\n lifecycleRules:\n - expiration:\n days: 500\n id: expire-all-start-with-abc-after-500-days\n status: Enabled\n filter:\n prefixFilter: \"abc\"\n ----------\n apiVersion: object.gdc.goog/v1\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: \"Bucket with lifecycle rule to expire objects having specific tag after 300 days\"\n storageClass: Standard\n bucketPolicy:\n lifecyclePolicy:\n enable: true\n lifecycleRules:\n - expiration:\n days: 300\n id: expire-all-objects-with-specific-tag-after-300-days\n status: Enabled\n filter:\n tagFilters:\n - key: testKey\n value: testValue\n\n| **Note:** If you also want to expire the noncurrent version, you need to set the `noncurrentExpiration` field in the lifecycle rule.\n\nAny updates to the lifecycle policy applies to the existing objects and\nobjects uploaded after the update.\n\nWhen the bucket also has object locking configured, objects are being\nprotected from expiration before the retention days end."]]