Skip to content
v2.278.0

InventoryDestination Struct ​

The destination of the inventory.

Example ​

ts
const inventoryBucket = new s3.Bucket(this, 'InventoryBucket');

const dataBucket = new s3.Bucket(this, 'DataBucket', {
  inventories: [
    {
      frequency: s3.InventoryFrequency.DAILY,
      includeObjectVersions: s3.InventoryObjectVersion.CURRENT,
      destination: {
        bucket: inventoryBucket,
      },
    },
    {
      frequency: s3.InventoryFrequency.WEEKLY,
      includeObjectVersions: s3.InventoryObjectVersion.ALL,
      destination: {
        bucket: inventoryBucket,
        prefix: 'with-all-versions',
      },
    },
  ],
});
python
inventory_bucket = s3.Bucket(self, "InventoryBucket")

data_bucket = s3.Bucket(self, "DataBucket",
    inventories=[s3.Inventory(
        frequency=s3.InventoryFrequency.DAILY,
        include_object_versions=s3.InventoryObjectVersion.CURRENT,
        destination=s3.InventoryDestination(
            bucket=inventory_bucket
        )
    ), s3.Inventory(
        frequency=s3.InventoryFrequency.WEEKLY,
        include_object_versions=s3.InventoryObjectVersion.ALL,
        destination=s3.InventoryDestination(
            bucket=inventory_bucket,
            prefix="with-all-versions"
        )
    )
    ]
)
java
Bucket inventoryBucket = new Bucket(this, "InventoryBucket");

Bucket dataBucket = Bucket.Builder.create(this, "DataBucket")
        .inventories(List.of(Inventory.builder()
                .frequency(InventoryFrequency.DAILY)
                .includeObjectVersions(InventoryObjectVersion.CURRENT)
                .destination(InventoryDestination.builder()
                        .bucket(inventoryBucket)
                        .build())
                .build(), Inventory.builder()
                .frequency(InventoryFrequency.WEEKLY)
                .includeObjectVersions(InventoryObjectVersion.ALL)
                .destination(InventoryDestination.builder()
                        .bucket(inventoryBucket)
                        .prefix("with-all-versions")
                        .build())
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var inventoryBucket = new Bucket(this, "InventoryBucket");

var dataBucket = new Bucket(this, "DataBucket", new BucketProps {
    Inventories = new [] { new Inventory {
        Frequency = InventoryFrequency.DAILY,
        IncludeObjectVersions = InventoryObjectVersion.CURRENT,
        Destination = new InventoryDestination {
            Bucket = inventoryBucket
        }
    }, new Inventory {
        Frequency = InventoryFrequency.WEEKLY,
        IncludeObjectVersions = InventoryObjectVersion.ALL,
        Destination = new InventoryDestination {
            Bucket = inventoryBucket,
            Prefix = "with-all-versions"
        }
    } }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
inventoryBucket := s3.NewBucket(this, jsii.String("InventoryBucket"))

dataBucket := s3.NewBucket(this, jsii.String("DataBucket"), &BucketProps{
	Inventories: []Inventory{
		&Inventory{
			Frequency: s3.InventoryFrequency_DAILY,
			IncludeObjectVersions: s3.InventoryObjectVersion_CURRENT,
			Destination: &InventoryDestination{
				Bucket: inventoryBucket,
			},
		},
		&Inventory{
			Frequency: s3.InventoryFrequency_WEEKLY,
			IncludeObjectVersions: s3.InventoryObjectVersion_ALL,
			Destination: &InventoryDestination{
				Bucket: inventoryBucket,
				Prefix: jsii.String("with-all-versions"),
			},
		},
	},
})

Properties ​

bucketIBucketbucketIBucketbucketIBucketBucketIBucketBucketIBucket required #
Bucket where all inventories will be saved in.
bucketOwneroptionalstringbucket_owneroptionalstrbucketOwneroptionalStringBucketOwneroptionalstringBucketOwneroptional*string #
The account ID that owns the destination S3 bucket.

Default: No account ID.

If no account ID is provided, the owner is not validated before exporting data. It's recommended to set an account ID to prevent problems if the destination bucket ownership changes.

prefixoptionalstringprefixoptionalstrprefixoptionalStringPrefixoptionalstringPrefixoptional*string #
The prefix to be used when saving the inventory.

Default: No prefix.