Skip to content

PutObjectRetention

Source: src/AWS/S3/PutObjectRetention.ts

Runtime binding for s3:PutObjectRetention.

Bind this operation to a bucket to get a callable that places an Object Lock retention configuration on an object — the bucket name is injected automatically and s3:PutObjectRetention is granted on the bucket’s objects. Requires a bucket created with objectLockEnabled: true; bypassing a GOVERNANCE retention additionally requires s3:BypassGovernanceRetention. Provide the implementation with Effect.provide(AWS.S3.PutObjectRetentionHttp).

const putObjectRetention = yield* AWS.S3.PutObjectRetention(bucket);
yield* putObjectRetention({
Key: "records/1.json",
Retention: {
Mode: "GOVERNANCE",
RetainUntilDate: new Date(Date.now() + 24 * 60 * 60 * 1000),
},
});