kendra / Client / create_access_control_configuration

create_access_control_configuration#

kendra.Client.create_access_control_configuration(**kwargs)#

Creates an access configuration for your documents. This includes user and group access information for your documents. This is useful for user context filtering, where search results are filtered based on the user or their group access to documents.

You can use this to re-configure your existing document level access control without indexing all of your documents again. For example, your index contains top-secret company documents that only certain employees or users should access. One of these users leaves the company or switches to a team that should be blocked from accessing top-secret documents. The user still has access to top-secret documents because the user had access when your documents were previously indexed. You can create a specific access control configuration for the user with deny access. You can later update the access control configuration to allow access if the user returns to the company and re-joins the ‘top-secret’ team. You can re-configure access control for your documents as circumstances change.

To apply your access control configuration to certain documents, you call the BatchPutDocument API with the AccessControlConfigurationId included in the Document object. If you use an S3 bucket as a data source, you update the .metadata.json with the AccessControlConfigurationId and synchronize your data source. Amazon Kendra currently only supports access control configuration for S3 data sources and documents indexed using the BatchPutDocument API.

Warning

You can’t configure access control using CreateAccessControlConfiguration for an Amazon Kendra Gen AI Enterprise Edition index. Amazon Kendra will return a ValidationException error for a Gen_AI_ENTERPRISE_EDITION index.

See also: AWS API Documentation

Request Syntax

response = client.create_access_control_configuration(
    IndexId='string',
    Name='string',
    Description='string',
    AccessControlList=[
        {
            'Name': 'string',
            'Type': 'USER'|'GROUP',
            'Access': 'ALLOW'|'DENY',
            'DataSourceId': 'string'
        },
    ],
    HierarchicalAccessControlList=[
        {
            'PrincipalList': [
                {
                    'Name': 'string',
                    'Type': 'USER'|'GROUP',
                    'Access': 'ALLOW'|'DENY',
                    'DataSourceId': 'string'
                },
            ]
        },
    ],
    ClientToken='string'
)
Parameters:
  • IndexId (string) –

    [REQUIRED]

    The identifier of the index to create an access control configuration for your documents.

  • Name (string) –

    [REQUIRED]

    A name for the access control configuration.

  • Description (string) – A description for the access control configuration.

  • AccessControlList (list) –

    Information on principals (users and/or groups) and which documents they should have access to. This is useful for user context filtering, where search results are filtered based on the user or their group access to documents.

    • (dict) –

      Provides user and group information for user context filtering.

      • Name (string) – [REQUIRED]

        The name of the user or group.

      • Type (string) – [REQUIRED]

        The type of principal.

      • Access (string) – [REQUIRED]

        Whether to allow or deny document access to the principal.

      • DataSourceId (string) –

        The identifier of the data source the principal should access documents from.

  • HierarchicalAccessControlList (list) –

    The list of principal lists that define the hierarchy for which documents users should have access to.

    • (dict) –

      Information to define the hierarchy for which documents users should have access to.

      • PrincipalList (list) – [REQUIRED]

        A list of principal lists that define the hierarchy for which documents users should have access to. Each hierarchical list specifies which user or group has allow or deny access for each document.

        • (dict) –

          Provides user and group information for user context filtering.

          • Name (string) – [REQUIRED]

            The name of the user or group.

          • Type (string) – [REQUIRED]

            The type of principal.

          • Access (string) – [REQUIRED]

            Whether to allow or deny document access to the principal.

          • DataSourceId (string) –

            The identifier of the data source the principal should access documents from.

  • ClientToken (string) –

    A token that you provide to identify the request to create an access control configuration. Multiple calls to the CreateAccessControlConfiguration API with the same client token will create only one access control configuration.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'Id': 'string'
}

Response Structure

  • (dict) –

    • Id (string) –

      The identifier of the access control configuration for your documents in an index.

Exceptions

  • kendra.Client.exceptions.ServiceQuotaExceededException

  • kendra.Client.exceptions.ValidationException

  • kendra.Client.exceptions.ThrottlingException

  • kendra.Client.exceptions.ConflictException

  • kendra.Client.exceptions.AccessDeniedException

  • kendra.Client.exceptions.ResourceNotFoundException

  • kendra.Client.exceptions.InternalServerException