Skip to content
v2.278.0

Inventory Struct ​

Specifies the inventory configuration of an S3 Bucket.

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'],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3

# bucket: s3.Bucket

inventory = s3.Inventory(
    destination=s3.InventoryDestination(
        bucket=bucket,

        # the properties below are optional
        bucket_owner="bucketOwner",
        prefix="prefix"
    ),

    # the properties below are optional
    enabled=False,
    format=s3.InventoryFormat.CSV,
    frequency=s3.InventoryFrequency.DAILY,
    include_object_versions=s3.InventoryObjectVersion.ALL,
    inventory_id="inventoryId",
    objects_prefix="objectsPrefix",
    optional_fields=["optionalFields"]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;

Bucket bucket;

Inventory inventory = Inventory.builder()
        .destination(InventoryDestination.builder()
                .bucket(bucket)

                // the properties below are optional
                .bucketOwner("bucketOwner")
                .prefix("prefix")
                .build())

        // the properties below are optional
        .enabled(false)
        .format(InventoryFormat.CSV)
        .frequency(InventoryFrequency.DAILY)
        .includeObjectVersions(InventoryObjectVersion.ALL)
        .inventoryId("inventoryId")
        .objectsPrefix("objectsPrefix")
        .optionalFields(List.of("optionalFields"))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;

Bucket bucket;

var inventory = new Inventory {
    Destination = new InventoryDestination {
        Bucket = bucket,

        // the properties below are optional
        BucketOwner = "bucketOwner",
        Prefix = "prefix"
    },

    // the properties below are optional
    Enabled = false,
    Format = InventoryFormat.CSV,
    Frequency = InventoryFrequency.DAILY,
    IncludeObjectVersions = InventoryObjectVersion.ALL,
    InventoryId = "inventoryId",
    ObjectsPrefix = "objectsPrefix",
    OptionalFields = new [] { "optionalFields" }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var bucket Bucket

inventory := &Inventory{
	Destination: &InventoryDestination{
		Bucket: bucket,

		// the properties below are optional
		BucketOwner: jsii.String("bucketOwner"),
		Prefix: jsii.String("prefix"),
	},

	// the properties below are optional
	Enabled: jsii.Boolean(false),
	Format: awscdk.Aws_s3.InventoryFormat_CSV,
	Frequency: awscdk.*Aws_s3.InventoryFrequency_DAILY,
	IncludeObjectVersions: awscdk.*Aws_s3.InventoryObjectVersion_ALL,
	InventoryId: jsii.String("inventoryId"),
	ObjectsPrefix: jsii.String("objectsPrefix"),
	OptionalFields: []*string{
		jsii.String("optionalFields"),
	},
}

Properties ​

The destination of the inventory.
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool = true #
Whether the inventory is enabled or disabled.
formatoptionalInventoryFormatformatoptionalInventoryFormatformatoptionalInventoryFormatFormatoptionalInventoryFormatFormatoptionalInventoryFormat = InventoryFormat.CSV #
The format of the inventory.
frequencyoptionalInventoryFrequencyfrequencyoptionalInventoryFrequencyfrequencyoptionalInventoryFrequencyFrequencyoptionalInventoryFrequencyFrequencyoptionalInventoryFrequency = InventoryFrequency.WEEKLY #
Frequency at which the inventory should be generated.
includeObjectVersionsoptionalInventoryObjectVersioninclude_object_versionsoptionalInventoryObjectVersionincludeObjectVersionsoptionalInventoryObjectVersionIncludeObjectVersionsoptionalInventoryObjectVersionIncludeObjectVersionsoptionalInventoryObjectVersion = InventoryObjectVersion.ALL #
If the inventory should contain all the object versions or only the current one.
inventoryIdoptionalstringinventory_idoptionalstrinventoryIdoptionalStringInventoryIdoptionalstringInventoryIdoptional*string #
The inventory configuration ID.

Default: generated ID.

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

objectsPrefixoptionalstringobjects_prefixoptionalstrobjectsPrefixoptionalStringObjectsPrefixoptionalstringObjectsPrefixoptional*string #
The inventory will only include objects that meet the prefix filter criteria.

Default: No objects prefix

optionalFieldsoptionalstring[]optional_fieldsoptionaltyping.List[str]optionalFieldsoptionalList<String>OptionalFieldsoptionalstring[]OptionalFieldsoptional*[]*string #
A list of optional fields to be included in the inventory result.

Default: No optional fields.