aws s3api get-object-retention
This operation is not supported for directory buckets. AWS CLI reference
1 example 5 options Its page in the AWS CLI reference
Examples
To retrieve the object retention configuration for an object
The following get-object-retention example retrieves the object retention configuration for the specified object.
aws s3api get-object-retention --bucket amzn-s3-demo-bucket --key doc1.rtfIdentify--bucketThe bucket name containing the object whose retention settings you want to retrieve.--keyThe key name for the object whose retention settings you want to retrieve.Its output
{
"Retention": {
"Mode": "GOVERNANCE",
"RetainUntilDate": "2025-01-01T00:00:00.000Z"
}
}For more information, see Locking objects with Object Lock in the Amazon S3 User Guide.
Options
--bucketThe bucket name containing the object whose retention settings you want to retrieve.--expected-bucket-ownerThe account ID of the expected bucket owner.--keyThe key name for the object whose retention settings you want to retrieve.--request-payerConfirms that the requester knows that they will be charged for the request.--version-idThe version ID for the object whose retention settings you want to retrieve.