

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::QBusiness::DataSource HookConfiguration
<a name="aws-properties-qbusiness-datasource-hookconfiguration"></a>

Provides the configuration information for invoking a Lambda function in AWS Lambda to alter document metadata and content when ingesting documents into Amazon Q Business.

You can configure your Lambda function using the `PreExtractionHookConfiguration` parameter if you want to apply advanced alterations on the original or raw documents.

If you want to apply advanced alterations on the Amazon Q Business structured documents, you must configure your Lambda function using `PostExtractionHookConfiguration`.

You can only invoke one Lambda function. However, this function can invoke other functions it requires.

For more information, see [Custom document enrichment](https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html). 

## Syntax
<a name="aws-properties-qbusiness-datasource-hookconfiguration-syntax"></a>

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

### JSON
<a name="aws-properties-qbusiness-datasource-hookconfiguration-syntax.json"></a>

```
{
  "[InvocationCondition](#cfn-qbusiness-datasource-hookconfiguration-invocationcondition)" : DocumentAttributeCondition,
  "[LambdaArn](#cfn-qbusiness-datasource-hookconfiguration-lambdaarn)" : String,
  "[RoleArn](#cfn-qbusiness-datasource-hookconfiguration-rolearn)" : String,
  "[S3BucketName](#cfn-qbusiness-datasource-hookconfiguration-s3bucketname)" : String
}
```

### YAML
<a name="aws-properties-qbusiness-datasource-hookconfiguration-syntax.yaml"></a>

```
  [InvocationCondition](#cfn-qbusiness-datasource-hookconfiguration-invocationcondition): 
    DocumentAttributeCondition
  [LambdaArn](#cfn-qbusiness-datasource-hookconfiguration-lambdaarn): String
  [RoleArn](#cfn-qbusiness-datasource-hookconfiguration-rolearn): String
  [S3BucketName](#cfn-qbusiness-datasource-hookconfiguration-s3bucketname): String
```

## Properties
<a name="aws-properties-qbusiness-datasource-hookconfiguration-properties"></a>

`InvocationCondition`  <a name="cfn-qbusiness-datasource-hookconfiguration-invocationcondition"></a>
The condition used for when a Lambda function should be invoked.  
For example, you can specify a condition that if there are empty date-time values, then Amazon Q Business should invoke a function that inserts the current date-time.  
*Required*: No  
*Type*: [DocumentAttributeCondition](aws-properties-qbusiness-datasource-documentattributecondition.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`LambdaArn`  <a name="cfn-qbusiness-datasource-hookconfiguration-lambdaarn"></a>
The Amazon Resource Name (ARN) of the Lambda function during ingestion. For more information, see [Using Lambda functions for Amazon Q Business document enrichment](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/cde-lambda-operations.html).  
*Required*: No  
*Type*: String  
*Pattern*: `^arn:aws[a-zA-Z-]*:lambda:[a-z-]*-[0-9]:[0-9]{12}:function:[a-zA-Z0-9-_]+(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?(:[a-zA-Z0-9-_]+)?$`  
*Minimum*: `1`  
*Maximum*: `2048`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`RoleArn`  <a name="cfn-qbusiness-datasource-hookconfiguration-rolearn"></a>
The Amazon Resource Name (ARN) of a role with permission to run `PreExtractionHookConfiguration` and `PostExtractionHookConfiguration` for altering document metadata and content during the document ingestion process.  
*Required*: No  
*Type*: String  
*Pattern*: `^arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}:[^/].{0,1023}$`  
*Minimum*: `0`  
*Maximum*: `1284`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`S3BucketName`  <a name="cfn-qbusiness-datasource-hookconfiguration-s3bucketname"></a>
Stores the original, raw documents or the structured, parsed documents before and after altering them. For more information, see [Data contracts for Lambda functions](https://docs.aws.amazon.com/amazonq/latest/business-use-dg/cde-lambda-operations.html#cde-lambda-operations-data-contracts).  
*Required*: No  
*Type*: String  
*Pattern*: `^[a-z0-9][\.\-a-z0-9]{1,61}[a-z0-9]$`  
*Minimum*: `1`  
*Maximum*: `63`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)