En esta página, se analiza la función de bloqueo de retención de objetos, que te permite establecer una configuración de retención en los objetos dentro de los buckets de Cloud Storage que habilitaron la función. Una configuración de retención rige por cuánto tiempo se debe retener el objeto y tiene la opción de evitar de forma permanente que se reduzca o se quite el tiempo de retención.
El bloqueo de retención de objetos te permite definir los requisitos de retención de datos por objeto. Esto difiere del bloqueo de buckets, que define los requisitos de retención de datos de manera uniforme para todos los objetos de un bucket. Con el bloqueo de retención de objetos, la configuración de retención que colocas en un objeto contiene las siguientes propiedades:
Un tiempo de retención que especifica una fecha y una hora hasta la cual se debe retener el objeto. Antes de este momento, el objeto no se puede borrar ni reemplazar. Ten en cuenta que un objeto que no alcanzó este tiempo de retención hasta que se pueda hacer no actual.
El tiempo de retención hasta tiene un valor máximo de 3,155,760,000 segundos (100 años) a partir de la fecha y hora actuales.
Un modo de retención que controla los cambios que puedes realizar en la configuración de retención.
Unlocked permite que los usuarios autorizados modifiquen o quiten la configuración de retención de un objeto sin limitaciones. En la API de XML, este modo se llama GOVERNANCE.
Locked evita que la fecha de retención se reduzca o se quite de forma permanente. Una vez establecido en Locked, el modo no se puede cambiar y el período de retención solo se puede aumentar. En la API de XML, este modo se llama COMPLIANCE.
Solo puedes establecer la configuración de retención en los objetos que residen en buckets que habilitaron la función.
Los buckets existentes solo pueden habilitar la función con la consola de Google Cloud .
Una vez habilitada, la función no se puede inhabilitar en un bucket.
Después de habilitar la función en un bucket, Cloud Storage aplica una retención al permiso projects.delete para el proyecto que contiene el bucket, con el mayor esfuerzo posible. Para saber si se aplicó una retención, enumera todas las retenciones del proyecto.
Mientras esté en vigor, esta retención impide que el proyecto se borre. Para borrar el proyecto, primero debes quitar la retención.
Consideraciones
Un bucket que contiene objetos retenidos no se puede borrar hasta que haya pasado el tiempo de retención hasta todos los objetos del bucket y se hayan borrado todos los objetos dentro de este.
Un objeto puede estar sujeto a su propia configuración de retención y a una política de retención de buckets general. Si es así, el objeto se retiene hasta que se cumplan ambas retenciones que se aplican a él.
Las solicitudes que intentan establecer una configuración de retención en un objeto que está sujeto a una conservación basada en eventos fallan.
Las solicitudes que establecen una configuración de retención para un objeto de forma simultánea y colocan una conservación basada en eventos en el objeto fallan de manera similar.
Un objeto puede tener una configuración de retención y una conservación temporal en simultáneo.
Puedes usar la Administración del ciclo de vida de los objetos para borrar objetos automáticamente, pero una regla de ciclo de vida no borrará un objeto hasta que alcance su fecha de vencimiento de retención, incluso si se cumplieron las condiciones de la regla del ciclo de vida.
En los buckets que usan control de versiones de objetos, una versión de objeto activa que tenga un tiempo de retención hasta el futuro aún puede convertirse en no actual.
No debes establecer configuraciones de retención en objetos que son temporales, como partes de un componente de carga compuesta paralela.
Los metadatos editables de un objeto no están sujetos a la configuración de retención y pueden modificarse incluso cuando el objeto en sí no pueda modificarse.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-05 (UTC)"],[],[],null,["# Object Retention Lock\n\n[Setup](/storage/docs/using-object-lock)\n\nThis page discusses the Object Retention Lock feature, which lets you set a\nretention configuration on objects within Cloud Storage buckets that\nhave enabled the feature. A retention configuration governs how long the object\nmust be retained and has the option to permanently prevent the retention time\nfrom being reduced or removed.\n\nIn conjunction with [Detailed audit logging mode](/storage/docs/org-policy-constraints#audit-logging), which logs\nCloud Storage request and response details, Object Retention Lock\n[can help with regulatory and compliance requirements](/security/compliance/sec-us), such as those\nassociated with FINRA, SEC, and CFTC. It can also help you address regulations\nin other industries such as health care.\n\nOverview\n--------\n\nObject Retention Lock lets you define data retention requirements on a\nper-object basis. This differs from [Bucket Lock](/storage/docs/bucket-lock), which defines data\nretention requirements uniformly for all objects in a bucket. With Object\nRetention Lock, the *retention configuration* that you place on an object\ncontains the following properties:\n\n- A *retain-until time* that specifies a date and time until which the object\n must be retained. Prior to this time, the object cannot be deleted or\n replaced. Note that an object that hasn't reached this retain-until time can\n still be [made noncurrent](/storage/docs/object-versioning).\n\n - The retain-until time has a maximum value of 3,155,760,000 seconds (100 years) from the current date and time.\n- A *retention mode* that controls what changes you can make to the retention\n configuration.\n\n - `Unlocked` allows authorized users to modify or remove an object's\n retention configuration without any limitations. In the XML API, this\n mode is named `GOVERNANCE`.\n\n - `Locked` permanently prevents the retention date from being reduced or\n removed. Once set to `Locked`, the mode cannot be changed, and\n the retention period can only be increased. In the XML API, this\n mode is named `COMPLIANCE`.\n\n - Locking a retention configuration can help your data\n [comply with record retention regulations](/security/compliance/sec-us).\n\nYou can only set retention configurations on objects that reside in buckets\nthat have enabled the feature.\n\n- Existing buckets can only enable the feature using the Google Cloud console.\n\n- Once enabled, the feature cannot be disabled on a bucket.\n\n- After you enable the feature on a bucket, Cloud Storage applies a\n [lien](/resource-manager/docs/project-liens) to the `projects.delete` permission for the project that contains\n the bucket, at best effort. To find out whether a lien has been applied,\n [list all project liens](/resource-manager/docs/project-liens#listing_liens_on_a_project).\n\n While in place, the lien prevents the project from being deleted. To delete\n the project, you must first [remove the lien](/resource-manager/docs/project-liens#removing_liens_from_a_project).\n\nConsiderations\n--------------\n\n- A bucket containing retained objects cannot be deleted until the retain-until\n time on all objects in the bucket has passed and all objects inside the\n bucket have been deleted.\n\n- An object can be subject to both its own retention configuration and an\n overall [bucket retention policy](/storage/docs/bucket-lock). If it is, the object is retained until\n both retentions that apply to it have been satisfied.\n\n - To see the earliest date that an object is eligible for deletion, [view the *retention expiration date* metadata](/storage/docs/viewing-editing-metadata#view) for the object.\n- Requests that attempt to set a retention configuration on a object that is\n subject to an [event-based hold](/storage/docs/object-holds) fail.\n\n - Requests that would simultaneously set a retention configuration for an\n object and place an event-based hold on the object similarly fail.\n\n - An object can simultaneously have a retention configuration and a\n [temporary hold](/storage/docs/object-holds).\n\n- You cannot destroy [Cloud Key Management Service key versions](/kms/docs/object-hierarchy#key_versions) that encrypt locked objects\n if the objects haven't met their retention expiration times. For more\n information, see [Key versions used to encrypt locked objects](/storage/docs/encryption/customer-managed-keys#locked-objects).\n\n- You can use [Object Lifecycle Management](/storage/docs/lifecycle) to automatically delete objects,\n but a lifecycle rule won't delete an object until after the object has\n reached its retention expiration date, even if the conditions of the\n lifecycle rule have been met.\n\n- In buckets that use [Object Versioning](/storage/docs/object-versioning), a live object version that has a\n retain-until time in the future can still be made noncurrent.\n\n- You shouldn't set retention configurations on objects that are meant to be\n temporary, such as component pieces of a [parallel composite upload](/storage/docs/parallel-composite-uploads).\n\n- An object's [editable metadata](/storage/docs/metadata#editable) is not subject to the retention\n configuration and can be modified even when the object itself cannot be.\n\nWhat's next\n-----------\n\n- [Use object retentions](/storage/docs/using-object-lock).\n- Learn about other Cloud Storage features that [protect objects and control their lifecycles](/storage/docs/control-data-lifecycles).\n- Learn about [Detailed audit logging mode](/storage/docs/org-policy-constraints#audit-logging), which can also help with regulatory and compliance requirements."]]