Skip to content

aws-ia/terraform-aws-opensearch-serverless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b3c9215 · Mar 17, 2025

History

22 Commits
Feb 14, 2025
Feb 14, 2025
Mar 17, 2025
Mar 17, 2025
Feb 14, 2025
Feb 14, 2025
Feb 26, 2025
Feb 14, 2025
Feb 14, 2025
Feb 14, 2025
Feb 14, 2025
Feb 14, 2025
Feb 14, 2025
Feb 14, 2025
Mar 17, 2025
Mar 17, 2025
Mar 17, 2025
Feb 24, 2025
Feb 21, 2025
Feb 28, 2025

Repository files navigation

Terraform OpenSearch Serverless Module

This module creates an Amazon OpenSearch Serverless collection optimized for vector search operations. OpenSearch Serverless automatically provisions and scales the underlying resources to deliver fast data ingestion and millisecond query response times.

Vector Collection

This module creates an Amazon OpenSearch Serverless collection configured for VECTORSEARCH. It creates default encryption, network, and data policies for use with Amazon Bedrock Knowledge Bases. For encryption, it uses the default AWS owned KMS key. It allows network connections from the public internet, but access is restricted to specific IAM principals.

Access Control

Access to the collection is secured through:

  • IAM-based authentication
  • Data access policies
  • Network policies
  • Encryption policies

Vector Index

This module also supports the creation of a vector index. The vector index resource connects to OpenSearch and creates an index suitable for use with Amazon Bedrock Knowledge Bases. You can create a vector index by setting the input variable create_vector_index to true. You can pass in values for the index_knn_algo_param_ef_search and the vector_index_mappings or you can leave the default values.

Requirements

Name Version
terraform >= 1.0.7
aws ~>5.0
awscc >= 1.0.0
opensearch = 2.2.0
random >= 3.6.0
time ~> 0.6

Providers

Name Version
aws ~>5.0
awscc >= 1.0.0
opensearch = 2.2.0
random >= 3.6.0
time ~> 0.6

Modules

No modules.

Resources

Name Type
aws_opensearchserverless_access_policy.data_policy resource
aws_opensearchserverless_security_policy.nw_policy resource
aws_opensearchserverless_security_policy.security_policy resource
awscc_opensearchserverless_collection.os_collection resource
opensearch_index.vector_index resource
random_string.solution_suffix resource
time_sleep.wait_before_index_creation resource
aws_caller_identity.current data source
aws_iam_session_context.current data source

Inputs

Name Description Type Default Required
allow_public_access_network_policy Whether or not to allow public access to the OpenSearch collection endpoint and the Dashboards endpoint. bool true no
collection_tags Tags to apply to the OpenSearch collection.
list(object({
key = string
value = string
}))
[] no
create_vector_index Whether or not to create vector index. bool false no
force_destroy_vector_index Whether or not to force destroy the vector index. bool true no
index_knn_algo_param_ef_search The size of the dynamic list used during k-NN searches. Higher values lead to more accurate but slower searches. string "512" no
number_of_replicas The number of replica shards. string "1" no
number_of_shards The number of shards for the index. This setting cannot be changed after index creation. string "1" no
vector_index_mappings A JSON string defining how documents in the index, and the fields they contain, are stored and indexed. To avoid the complexities of field mapping updates, updates of this field are not allowed via this provider. string null no

Outputs

Name Description
opensearch_serverless_collection Opensearch collection value.
opensearch_serverless_data_policy Opensearch serverless data policy value.
vector_index Opensearch vector index value.