# ObjectLockConfigurationProperty

Places an Object Lock configuration on the specified bucket.

The rule specified in the Object Lock configuration will be applied by default to every new object placed in the specified bucket. For more information, see [Locking Objects](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) .

- Source: Generated code
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';
const objectLockConfigurationProperty: s3.CfnBucket.ObjectLockConfigurationProperty = {
  objectLockEnabled: 'objectLockEnabled',
  rule: {
    defaultRetention: {
      days: 123,
      defaultEventHold: {
        days: 123,
        years: 123,
      },
      mode: 'mode',
      years: 123,
    },
  },
};
```

## Properties

- `objectLockEnabled`: string — Indicates whether this bucket has an Object Lock configuration enabled.

  Enable `ObjectLockEnabled` when you apply `ObjectLockConfiguration` to a bucket.

- `rule`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnBucket.ObjectLockRuleProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.CfnBucket.ObjectLockRuleProperty.html) — Specifies the Object Lock rule for the specified object.

  Enable this rule when you apply `ObjectLockConfiguration` to a bucket. If Object Lock is turned on, bucket settings require both `Mode` and a period of either `Days` or `Years` . You cannot specify `Days` and `Years` at the same time. For more information, see [ObjectLockRule](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-objectlockrule.html) and [DefaultRetention](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-defaultretention.html) .
