'How can I set compatibility mode for Amazon OpenSearch using CloudFormation?

Since AWS has replaced ElasticSearch with OpenSearch, some clients have issues connecting to the OpenSearch Service.

To avoid that, we can enable compatibility mode during the cluster creation.

Certain Elasticsearch OSS clients, such as Logstash, check the cluster version before connecting. Compatibility mode sets OpenSearch to report its version as 7.10 so that these clients continue to work with the service.

I'm trying to use CloudFormation to create a cluster using AWS::OpenSearchService::Domain instead of AWS::Elasticsearch::Domain but I can't see a way to enable compatibility mode.



Solution 1:[1]

You can add this in the advanced section tab AdvancedOptions.

Example:

Resources: OpenSearchServiceDomain: Type: AWS::OpenSearchService::Domain Properties: AdvancedOptions: override_main_response_version: true

Solution 2:[2]

To do this in terraform use the config

resource "aws_elasticsearch_domain" "search" {
  domain_name = "search"

  advanced_options = {
    "override_main_response_version" = "true"
  }
}

docs can be found can be found here https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticsearch_domain

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Damo