AWS::S3::Bucket InventoryConfiguration - AWS CloudFormation

AWS::S3::Bucket InventoryConfiguration

Specifies the inventory configuration for an Amazon S3 bucket. For more information, see GET Bucket inventory in the Amazon S3 API Reference.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Destination" : Destination, "Enabled" : Boolean, "Id" : String, "IncludedObjectVersions" : String, "OptionalFields" : [ String, ... ], "Prefix" : String, "ScheduleFrequency" : String }

YAML

Destination: Destination Enabled: Boolean Id: String IncludedObjectVersions: String OptionalFields: - String Prefix: String ScheduleFrequency: String

Properties

Destination

Contains information about where to publish the inventory results.

Required: Yes

Type: Destination

Update requires: No interruption

Enabled

Specifies whether the inventory is enabled or disabled. If set to True, an inventory list is generated. If set to False, no inventory list is generated.

Required: Yes

Type: Boolean

Update requires: No interruption

Id

The ID used to identify the inventory configuration.

Required: Yes

Type: String

Update requires: No interruption

IncludedObjectVersions

Object versions to include in the inventory list. If set to All, the list includes all the object versions, which adds the version-related fields VersionId, IsLatest, and DeleteMarker to the list. If set to Current, the list does not contain these version-related fields.

Required: Yes

Type: String

Allowed values: All | Current

Update requires: No interruption

OptionalFields

Contains the optional fields that are included in the inventory results.

Required: No

Type: Array of String

Allowed values: Size | LastModifiedDate | StorageClass | ETag | IsMultipartUploaded | ReplicationStatus | EncryptionStatus | ObjectLockRetainUntilDate | ObjectLockMode | ObjectLockLegalHoldStatus | IntelligentTieringAccessTier | BucketKeyStatus | ChecksumAlgorithm | ObjectAccessControlList | ObjectOwner

Update requires: No interruption

Prefix

Specifies the inventory filter prefix.

Required: No

Type: String

Update requires: No interruption

ScheduleFrequency

Specifies the schedule for generating inventory results.

Required: Yes

Type: String

Allowed values: Daily | Weekly

Update requires: No interruption

Examples

Specify analytics and inventory configurations for an S3 bucket

The following example specifies analytics and inventory results to be generated for an S3 bucket, including the format of the results and the destination bucket. The inventory list generates reports weekly and includes the current version of each object.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "S3 Bucket with Inventory and Analytics Configurations", "Resources": { "Helper": { "Type": "AWS::S3::Bucket" }, "S3Bucket": { "Type": "AWS::S3::Bucket", "Properties": { "AnalyticsConfigurations": [ { "Id": "AnalyticsConfigurationId", "StorageClassAnalysis": { "DataExport": { "Destination": { "BucketArn": { "Fn::GetAtt": [ "Helper", "Arn" ] }, "Format": "CSV", "Prefix": "AnalyticsDestinationPrefix" }, "OutputSchemaVersion": "V_1" } }, "Prefix": "AnalyticsConfigurationPrefix", "TagFilters": [ { "Key": "AnalyticsTagKey", "Value": "AnalyticsTagValue" } ] } ], "InventoryConfigurations": [ { "Id": "InventoryConfigurationId", "Destination": { "BucketArn": { "Fn::GetAtt": [ "Helper", "Arn" ] }, "Format": "CSV", "Prefix": "InventoryDestinationPrefix" }, "Enabled": true, "IncludedObjectVersions": "Current", "Prefix": "InventoryConfigurationPrefix", "ScheduleFrequency": "Weekly" } ] } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Description: S3 Bucket with Inventory and Analytics Configurations Resources: Helper: Type: 'AWS::S3::Bucket' S3Bucket: Type: 'AWS::S3::Bucket' Properties: AnalyticsConfigurations: - Id: AnalyticsConfigurationId StorageClassAnalysis: DataExport: Destination: BucketArn: !GetAtt - Helper - Arn Format: CSV Prefix: AnalyticsDestinationPrefix OutputSchemaVersion: V_1 Prefix: AnalyticsConfigurationPrefix TagFilters: - Key: AnalyticsTagKey Value: AnalyticsTagValue InventoryConfigurations: - Id: InventoryConfigurationId Destination: BucketArn: !GetAtt - Helper - Arn Format: CSV Prefix: InventoryDestinationPrefix Enabled: true IncludedObjectVersions: Current Prefix: InventoryConfigurationPrefix ScheduleFrequency: Weekly