You can manage object locks in the control panel, via the S3 API, and via tools that use it, such as the AWS CLI.
Retention-period lock
Check for a retention-period lock
If you have segmented objects, you cannot check the lock status on individual segments — you can only check the lock on the object itself. Segments inherit the lock settings applied to the object.
Control panel
AWS CLI
In the control panel, in the top menu, click Products and select S3.
Go to Buckets.
Open the bucket page → Objects tab.
Open the object page.
In the Object Lock block, check the retention status.
Open the CLI.
If you want to check the lock for a specific object version:
<path_to_object> — path to the object in the bucket.
2.2. For the required object version, copy the identifier specified in the VersionId field.
Check for the lock:
aws s3api get-object-retention \
--bucket<bucket_name>\
--key<path_to_object>\
--version-id <version_id>
Specify:
<bucket_name> — bucket name;
<path_to_object> — path to the object in the bucket;
optional: --version-id <version_id> — parameter that specifies a specific object version. Here, <version_id> is the version ID you copied in step 2.2. If this parameter is omitted, the lock will be checked for the current object version.
Enable retention-period lock
If both a retention-period lock and a legal hold are enabled for an object, the legal hold takes precedence.
<path_to_object> — path to the object in the bucket;
optional: --version-id <version_id> — parameter that specifies a specific object version. Here, <version_id> is the version ID you copied in step 2.2. If this parameter is omitted, the lock will be applied to the current object version;
<lock_mode> — lock mode. Possible values are GOVERNANCE or COMPLIANCE;
<date> — date until which the object will be locked, in ISO 8601 format, for example, 2025-09-06T00:00:00Z. The object lock retention period cannot exceed 100 years.
Change temporary lock duration
If the lock mode is set to:
Governance — the lock duration can be shortened or extended;
Compliance — the lock duration can only be extended.
Control panel
AWS CLI
In the control panel, you can only increase the lock period. To decrease the period, use the S3 API or tools that use it, such as the AWS CLI.
In the control panel, in the top menu, click Products and select S3.
Go to Buckets.
Open the bucket page → Objects tab.
Open the object page.
In the Object Lock block, in the Retention line, click Edit.
Specify the new lock duration. Maximum lock duration:
for Compliance mode — one year. To set a Compliance lock for more than one year, use the API or tools, such as AWS CLI;
for Governance mode — 100 years.
Click Save.
To change the lock period, use the Enable retention section and specify a new value in the RetainUntilDate field.
Change temporary lock mode
You can only change the lock mode from Governance to Compliance.
Control panel
AWS CLI
You cannot change the retention mode in the control panel. Use the S3 API or tools that use it, such as the AWS CLI.
To change the lock mode, use the Enable retention section and in the Mode field, specify the value COMPLIANCE.
Disable temporary lock
You can only disable a temporary lock in Governance mode.
Control panel
AWS CLI
Only the Account Owner or a user with the member role can disable retention in the control panel.
In the control panel, in the top menu, click Products and select S3.
Go to Buckets.
Open the bucket page → Objects tab.
Open the object page.
In the Object Lock block, in the Retention line, click Edit.
Clear the Lock object checkbox.
Click Save.
Disabling retention via the AWS CLI can be done by the Account Owner, a user with the member role, or a user with another role with access to S3 if the access policy allows them the actions3:BypassGovernanceRetention.
Open the CLI.
If you want to disable the lock for a specific object version:
<path_to_object> — path to the object in the bucket.
2.2. For the required object version, copy the identifier specified in the VersionId field.
Disable the lock:
aws s3api put-object-retention \
--bucket<bucket_name>\
--key"<path_to_object>"\
--version-id <version_id>\
--retention'{}'\
--bypass-governance-retention
Specify:
<bucket_name> — bucket name;
<path_to_object> — path to the object in the bucket;
optional: --version-id <version_id> — parameter that specifies a specific object version. Here, <version_id> is the version ID you copied in step 2.2. If this parameter is omitted, the lock will be disabled for the current object version.
Legal hold
Check for a legal hold
If you have segmented objects, you cannot check the lock status on individual segments — you can only check the lock on the object itself. Segments inherit the lock settings applied to the object.
Control panel
AWS CLI
In the control panel, in the top menu, click Products and select S3.
Go to Buckets.
Open the bucket page → Objects tab.
Open the object page.
In the Object Lock block, check the legal hold status.
Open the CLI.
If you want to check the lock for a specific object version:
<path_to_object> — path to the object in the bucket.
2.2. For the required object version, copy the identifier specified in the VersionId field.
Check for the lock:
aws s3api get-object-legal-hold \
--bucket<bucket_name>\
--key<path_to_object>\
--version-id <version_id>
Specify:
<bucket_name> — bucket name;
<path_to_object> — path to the object in the bucket;
optional: --version-id <version_id> — parameter that specifies a specific object version. Here, <version_id> is the version ID you copied in step 2.2. If this parameter is omitted, the lock will be checked for the current object version.
Enable legal hold
If both a temporary lock and a legal hold are enabled for an object at the same time, the legal hold has priority.
Control panel
AWS CLI
In the control panel, in the top menu, click Products and select S3.
Go to Buckets.
Open the bucket page → Objects tab.
Open the object page.
In the Object Lock block, enable legal hold.
Open the CLI.
If you want to lock an object version other than the current one:
<path_to_object> — path to the object in the bucket.
2.2. For the required object version, copy the identifier specified in the VersionId field.
Lock the object:
aws s3api put-object-legal-hold \
--bucket<bucket_name>\
--key<path_to_object>\
--version-id <version_id>\
--legal-hold '{"Status": "ON"}'
Specify:
<bucket_name> — bucket name;
<path_to_object> — path to the object in the bucket;
optional: --version-id <version_id> — parameter that specifies a specific object version. Here, <version_id> is the version ID you copied in step 2.2. If this parameter is omitted, the lock will be applied to the current object version.
Disable legal hold
Control panel
AWS CLI
In the control panel, in the top menu, click Products and select S3.
Go to Buckets.
Open the bucket page → Objects tab.
Open the object page.
In the Object Lock block, disable legal hold.
Open the CLI.
If you want to disable the lock for an object version other than the current one:
<path_to_object> — path to the object in the bucket.
2.2. For the required object version, copy the identifier specified in the VersionId field.
Disable the lock:
aws s3api put-object-legal-hold \
--bucket<bucket_name>\
--key<path_to_object>\
--version-id <version_id>\
--legal-hold '{"Status": "OFF"}'
Specify:
<bucket_name> — bucket name;
<path_to_object> — path to the object in the bucket;
optional: --version-id <version_id> — parameter that specifies a specific object version. Here, <version_id> is the version ID you copied in step 2.2. If this parameter is omitted, the lock will be removed from the current object version.