Connecting Amazon Q Business to Amazon S3 using APIs
You use the CreateDataSource action to connect a data source to your Amazon Q application. You can also use the UpdateDataSource action to modify an existing data source configuration.
Then, you use the
configuration
parameter to provide a JSON blob that conforms the AWS-defined JSON schema.
For an example of the API request, see CreateDataSource and UpdateDataSource in the Amazon Q API Reference.
Amazon S3 configuration properties
The following provides information about important configuration properties required in the schema.
Configuration | Description | Type | Required |
---|---|---|---|
|
The type of data source. Specify |
The only allowed value is |
Yes |
|
Configuration information for the endpoint for the data source. |
This property has sub-properties: |
Yes |
|
The name of your Amazon S3 bucket. This is a sub-property for the
|
|
Yes |
|
The 12-digit AWS account ID that owns the S3 bucket. This is a sub-property for the
|
Must match pattern: |
Yes |
|
Configuration for filtering which files to include or exclude from indexing. |
This property has sub-properties for patterns, prefixes, and file size limits. |
No |
|
File patterns to include during indexing . This is a sub-property for the
|
|
No |
|
File patterns to exclude during indexing. This is a sub-property for the
|
|
No |
|
S3 key prefixes to include during indexing (e.g., documents/, reports/). This is a sub-property for the
|
|
No |
|
S3 key prefixes to exclude during indexing (e.g., temp/, cache/). This is a sub-property for the
|
|
No |
|
Maximum file size in megabytes to index. Files larger than this will be skipped. This is a sub-property for the
|
Minimum: 0, Maximum: 10240 |
No |
|
Configuration for access control and permissions. |
This property has sub-properties for ACL configuration and default access type. |
No |
|
Path to the ACL configuration file in your S3 bucket. This is a sub-property for the
|
Length: 1-1024 characters |
No |
|
Configuration for deletion protection to prevent accidental bulk deletions. |
This property has sub-properties for enabling deletion protection and setting thresholds. |
No |
|
Whether to enable deletion protection. This is a sub-property for the
|
|
No |
|
Percentage threshold for deletion protection. If more than this percentage of documents would be deleted, the sync will be blocked. This is a sub-property for the
|
Default: 15 |
No |
|
S3 key prefix where metadata files are stored for enhanced document processing. |
Length: 1-1024 characters |
No |
Amazon S3 JSON schema
The following is the Amazon S3 JSON schema with simplified configuration structure:
{ "type": "object", "properties": { "type": { "type": "string", "pattern": "S3V2" }, "connectionConfiguration": { "type": "object", "properties": { "bucketName": { "type": "string" }, "bucketOwnerAccountId": { "type": "string", "pattern": "^\\d{12}$" } }, "required": ["bucketName", "bucketOwnerAccountId"] }, "filterConfiguration": { "type": "object", "properties": { "inclusionPatterns": { "type": "array", "items": { "type": "string" } }, "exclusionPatterns": { "type": "array", "items": { "type": "string" } }, "inclusionPrefixes": { "type": "array", "items": { "type": "string" } }, "exclusionPrefixes": { "type": "array", "items": { "type": "string" } }, "maxFileSizeInMegaBytes": { "type": "number", "minimum": 0, "maximum": 10240 } } }, "accessControlConfiguration": { "type": "object", "properties": { "aclConfigurationFilePath": { "type": "string", "minLength": 1, "maxLength": 1024 } } }, "deletionProtectionConfiguration": { "type": "object", "properties": { "enableDeletionProtection": { "type": "boolean" }, "deletionProtectionThreshold": { "type": "number", "default": 15 } } }, "metadataFilesPrefix": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": [ "type", "connectionConfiguration" ] }
Amazon S3 JSON schema example
The following is the Amazon S3 JSON schema example with simplified configuration:
{ "type": "S3V2", "connectionConfiguration": { "bucketName": "my-company-data-bucket", "bucketOwnerAccountId": "123456789012" }, "filterConfiguration": { "inclusionPrefixes": ["documents/", "reports/"], "exclusionPrefixes": ["temp/", "cache/"], "maxFileSizeInMegaBytes": 100 }, "accessControlConfiguration": { "aclConfigurationFilePath": "config/acl-config.json" }, "deletionProtectionConfiguration": { "enableDeletionProtection": true, "deletionProtectionThreshold": 15 }, "metadataFilesPrefix": "metadata/" }