Skip to content

Resource: awsKendraIndex

Provides an Amazon Kendra Index resource.

Example Usage

Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.kendraIndex.KendraIndex(this, "example", {
  description: "example",
  edition: "DEVELOPER_EDITION",
  name: "example",
  roleArn: "${aws_iam_role.this.arn}",
  tags: {
    Key1: "Value1",
  },
});

With capacity units

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.kendraIndex.KendraIndex(this, "example", {
  capacityUnits: {
    queryCapacityUnits: 2,
    storageCapacityUnits: 2,
  },
  edition: "DEVELOPER_EDITION",
  name: "example",
  roleArn: "${aws_iam_role.this.arn}",
});

With server side encryption configuration

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.kendraIndex.KendraIndex(this, "example", {
  name: "example",
  roleArn: "${aws_iam_role.this.arn}",
  serverSideEncryptionConfiguration: {
    kmsKeyId: "${data.aws_kms_key.this.arn}",
  },
});

With Document Metadata Configuration Updates

Specifying the predefined elements

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.kendraIndex.KendraIndex(this, "example", {
  documentMetadataConfigurationUpdates: [
    {
      name: "_authors",
      relevance: {
        importance: 1,
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: false,
      },
      type: "STRING_LIST_VALUE",
    },
    {
      name: "_category",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_created_at",
      relevance: {
        duration: "25920000s",
        freshness: false,
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "DATE_VALUE",
    },
    {
      name: "_data_source_id",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_document_title",
      relevance: {
        importance: 2,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: true,
        facetable: false,
        searchable: true,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_excerpt_page_number",
      relevance: {
        importance: 2,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: false,
      },
      type: "LONG_VALUE",
    },
    {
      name: "_faq_id",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_file_type",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_language_code",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_last_updated_at",
      relevance: {
        duration: "25920000s",
        freshness: false,
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "DATE_VALUE",
    },
    {
      name: "_source_uri",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: true,
        facetable: false,
        searchable: false,
        sortable: false,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_version",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_view_count",
      relevance: {
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "LONG_VALUE",
    },
  ],
  name: "example",
  roleArn: "${aws_iam_role.this.arn}",
});

Appending additional elements

The example below shows additional elements with names, exampleStringValue, exampleLongValue, exampleStringListValue, exampleDateValue representing the 4 types of STRING_VALUE, LONG_VALUE, STRING_LIST_VALUE, DATE_VALUE respectively.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.kendraIndex.KendraIndex(this, "example", {
  documentMetadataConfigurationUpdates: [
    {
      name: "_authors",
      relevance: {
        importance: 1,
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: false,
      },
      type: "STRING_LIST_VALUE",
    },
    {
      name: "_category",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_created_at",
      relevance: {
        duration: "25920000s",
        freshness: false,
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "DATE_VALUE",
    },
    {
      name: "_data_source_id",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_document_title",
      relevance: {
        importance: 2,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: true,
        facetable: false,
        searchable: true,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_excerpt_page_number",
      relevance: {
        importance: 2,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: false,
      },
      type: "LONG_VALUE",
    },
    {
      name: "_faq_id",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_file_type",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_language_code",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_last_updated_at",
      relevance: {
        duration: "25920000s",
        freshness: false,
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "DATE_VALUE",
    },
    {
      name: "_source_uri",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: true,
        facetable: false,
        searchable: false,
        sortable: false,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_version",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "_view_count",
      relevance: {
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: false,
        facetable: false,
        searchable: false,
        sortable: true,
      },
      type: "LONG_VALUE",
    },
    {
      name: "example-string-value",
      relevance: {
        importance: 1,
        valuesImportanceMap: [{}],
      },
      search: {
        displayable: true,
        facetable: true,
        searchable: true,
        sortable: true,
      },
      type: "STRING_VALUE",
    },
    {
      name: "example-long-value",
      relevance: {
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: true,
        facetable: true,
        searchable: false,
        sortable: true,
      },
      type: "LONG_VALUE",
    },
    {
      name: "example-string-list-value",
      relevance: {
        importance: 1,
      },
      search: {
        displayable: true,
        facetable: true,
        searchable: true,
        sortable: false,
      },
      type: "STRING_LIST_VALUE",
    },
    {
      name: "example-date-value",
      relevance: {
        duration: "25920000s",
        freshness: false,
        importance: 1,
        rankOrder: "ASCENDING",
      },
      search: {
        displayable: true,
        facetable: true,
        searchable: false,
        sortable: false,
      },
      type: "DATE_VALUE",
    },
  ],
  name: "example",
  roleArn: "${aws_iam_role.this.arn}",
});

With JSON token type configuration

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.kendraIndex.KendraIndex(this, "example", {
  name: "example",
  roleArn: "${aws_iam_role.this.arn}",
  userTokenConfigurations: {
    jsonTokenTypeConfiguration: {
      groupAttributeField: "groups",
      userNameAttributeField: "username",
    },
  },
});

Argument Reference

The following arguments are supported:

  • capacityUnits - (Optional) A block that sets the number of additional document storage and query capacity units that should be used by the index. Detailed below.
  • description - (Optional) The description of the Index.
  • documentMetadataConfigurationUpdates - (Optional) One or more blocks that specify the configuration settings for any metadata applied to the documents in the index. Minimum number of 0 items. Maximum number of 500 items. If specified, you must define all elements, including those that are provided by default. These index fields are documented at Amazon Kendra Index documentation. For an example resource that defines these default index fields, refer to the default example above. For an example resource that appends additional index fields, refer to the append example above. All arguments for each block must be specified. Note that blocks cannot be removed since index fields cannot be deleted. This argument is detailed below.
  • edition - (Optional) The Amazon Kendra edition to use for the index. Choose DEVELOPER_EDITION for indexes intended for development, testing, or proof of concept. Use ENTERPRISE_EDITION for your production databases. Once you set the edition for an index, it can't be changed. Defaults to ENTERPRISE_EDITION
  • name - (Required) Specifies the name of the Index.
  • roleArn - (Required) An AWS Identity and Access Management (IAM) role that gives Amazon Kendra permissions to access your Amazon CloudWatch logs and metrics. This is also the role you use when you call the batchPutDocument API to index documents from an Amazon S3 bucket.
  • serverSideEncryptionConfiguration - (Optional) A block that specifies the identifier of the AWS KMS customer managed key (CMK) that's used to encrypt data indexed by Amazon Kendra. Amazon Kendra doesn't support asymmetric CMKs. Detailed below.
  • userContextPolicy - (Optional) The user context policy. Valid values are ATTRIBUTE_FILTER or USER_TOKEN. For more information, refer to UserContextPolicy. Defaults to ATTRIBUTE_FILTER.
  • userGroupResolutionConfiguration - (Optional) A block that enables fetching access levels of groups and users from an AWS Single Sign-On identity source. To configure this, see UserGroupResolutionConfiguration. Detailed below.
  • userTokenConfigurations - (Optional) A block that specifies the user token configuration. Detailed below.
  • tags - (Optional) Tags to apply to the Index. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

capacityUnits

A capacityUnits block supports the following arguments:

  • queryCapacityUnits - (Required) The amount of extra query capacity for an index and GetQuerySuggestions capacity. For more information, refer to QueryCapacityUnits.
  • storageCapacityUnits - (Required) The amount of extra storage capacity for an index. A single capacity unit provides 30 GB of storage space or 100,000 documents, whichever is reached first. Minimum value of 0.

documentMetadataConfigurationUpdates

A documentMetadataConfigurationUpdates block supports the following arguments:

  • name - (Required) The name of the index field. Minimum length of 1. Maximum length of 30.
  • relevance - (Required) A block that provides manual tuning parameters to determine how the field affects the search results. Detailed below
  • search - (Required) A block that provides information about how the field is used during a search. Documented below. Detailed below
  • type - (Required) The data type of the index field. Valid values are STRING_VALUE, STRING_LIST_VALUE, LONG_VALUE, DATE_VALUE.

relevance

A relevance block supports the following attributes:

  • duration - (Required if type is of DATE_VALUE) Specifies the time period that the boost applies to. For more information, refer to Duration.
  • freshness - (Required if type is of DATE_VALUE) Indicates that this field determines how "fresh" a document is. For more information, refer to Freshness.
  • importance - (Required for all types) The relative importance of the field in the search. Larger numbers provide more of a boost than smaller numbers. Minimum value of 1. Maximum value of 10.
  • rankOrder - (Required if type is of DATE_VALUE, or LONG_VALUE) Determines how values should be interpreted. For more information, refer to RankOrder.
  • valuesImportanceMap - (Required if type is of STRING_VALUE) A list of values that should be given a different boost when they appear in the result list. For more information, refer to ValueImportanceMap.

A search block supports the following attributes:

  • displayable - (Required) Determines whether the field is returned in the query response. The default is true.
  • facetable - (Required) Indicates that the field can be used to create search facets, a count of results for each value in the field. The default is false.
  • searchable - (Required) Determines whether the field is used in the search. If the Searchable field is true, you can use relevance tuning to manually tune how Amazon Kendra weights the field in the search. The default is true for string fields and false for number and date fields.
  • sortable - (Required) Determines whether the field can be used to sort the results of a query. If you specify sorting on a field that does not have Sortable set to true, Amazon Kendra returns an exception. The default is false.

serverSideEncryptionConfiguration

A serverSideEncryptionConfiguration block supports the following arguments:

  • kmsKeyId - (Optional) The identifier of the AWS KMScustomer master key (CMK). Amazon Kendra doesn't support asymmetric CMKs.

userGroupResolutionConfiguration

A userGroupResolutionConfiguration block supports the following arguments:

  • userGroupResolutionMode - (Required) The identity store provider (mode) you want to use to fetch access levels of groups and users. AWS Single Sign-On is currently the only available mode. Your users and groups must exist in an AWS SSO identity source in order to use this mode. Valid Values are AWS_SSO or none.

userTokenConfigurations

A userTokenConfigurations block supports the following arguments:

  • jsonTokenTypeConfiguration - (Optional) A block that specifies the information about the JSON token type configuration. Detailed below.
  • jwtTokenTypeConfiguration - (Optional) A block that specifies the information about the JWT token type configuration. Detailed below.

jsonTokenTypeConfiguration

A jsonTokenTypeConfiguration block supports the following arguments:

  • groupAttributeField - (Required) The group attribute field. Minimum length of 1. Maximum length of 2048.
  • userNameAttributeField - (Required) The user name attribute field. Minimum length of 1. Maximum length of 2048.

jwtTokenTypeConfiguration

A jwtTokenTypeConfiguration block supports the following arguments:

  • claimRegex - (Optional) The regular expression that identifies the claim. Minimum length of 1. Maximum length of 100.
  • groupAttributeField - (Optional) The group attribute field. Minimum length of 1. Maximum length of 100.
  • issuer - (Optional) The issuer of the token. Minimum length of 1. Maximum length of 65.
  • keyLocation - (Required) The location of the key. Valid values are url or SECRET_MANAGER
  • secretsManagerArn - (Optional) The Amazon Resource Name (ARN) of the secret.
  • url - (Optional) The signing key URL. Valid pattern is ^(https?|ftp|file):\/\/([^\s]*)
  • userNameAttributeField - (Optional) The user name attribute field. Minimum length of 1. Maximum length of 100.

Timeouts

Configuration options:

  • create - (Default 40M)
  • delete - (Default 40M)
  • update - (Default 40M)

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) of the Index.
  • createdAt - The Unix datetime that the index was created.
  • errorMessage - When the Status field value is failed, this contains a message that explains why.
  • id - The identifier of the Index.
  • indexStatistics - A block that provides information about the number of FAQ questions and answers and the number of text documents indexed. Detailed below.
  • status - The current status of the index. When the value is active, the index is ready for use. If the Status field value is failed, the errorMessage field contains a message that explains why.
  • updatedAt - The Unix datetime that the index was last updated.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

indexStatistics

A indexStatistics block supports the following attributes:

  • faqStatistics - A block that specifies the number of question and answer topics in the index. Detailed below.
  • textDocumentStatistics - A block that specifies the number of text documents indexed. Detailed below.

faqStatistics

A faqStatistics block supports the following attributes:

  • indexedQuestionAnswersCount - The total number of FAQ questions and answers contained in the index.

textDocumentStatistics

A textDocumentStatistics block supports the following attributes:

  • indexedTextBytes - The total size, in bytes, of the indexed documents.
  • indexedTextDocumentsCount - The number of text documents indexed.

Import

Amazon Kendra Indexes can be imported using its id, e.g.,

$ terraform import aws_kendra_index.example 12345678-1234-5678-9123-123456789123