# Inventory

Specifies the inventory configuration of an S3 Bucket.

- Source: [`aws-s3/lib/bucket.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L1406)

## 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';

declare const bucket: s3.Bucket;
const inventory: s3.Inventory = {
  destination: {
    bucket: bucket,

    // the properties below are optional
    bucketOwner: 'bucketOwner',
    prefix: 'prefix',
  },

  // the properties below are optional
  enabled: false,
  format: s3.InventoryFormat.CSV,
  frequency: s3.InventoryFrequency.DAILY,
  includeObjectVersions: s3.InventoryObjectVersion.ALL,
  inventoryId: 'inventoryId',
  objectsPrefix: 'objectsPrefix',
  optionalFields: ['optionalFields'],
};
```

## Properties

- `destination`: [InventoryDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryDestination.html) (required) — The destination of the inventory.

- `enabled`: boolean = true — Whether the inventory is enabled or disabled.

- `format`: [InventoryFormat](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryFormat.html) = InventoryFormat.CSV — The format of the inventory.

- `frequency`: [InventoryFrequency](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryFrequency.html) = InventoryFrequency.WEEKLY — Frequency at which the inventory should be generated.

- `includeObjectVersions`: [InventoryObjectVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryObjectVersion.html) = InventoryObjectVersion.ALL — If the inventory should contain all the object versions or only the current one.

- `inventoryId`: string — The inventory configuration ID.

  **Default:** generated ID.

  Should be limited to 64 characters and can only contain letters, numbers, periods, dashes, and underscores.

- `objectsPrefix`: string — The inventory will only include objects that meet the prefix filter criteria.

  **Default:** No objects prefix

- `optionalFields`: string[] — A list of optional fields to be included in the inventory result.

  **Default:** No optional fields.
