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

2.2k Views Asked by At

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.

3

There are 3 best solutions below

0
Robert Kossendey On BEST ANSWER

The AWS::OpenSearchService::Domain CloudFormation resource has a property called AdvancedOptions.

As per documentation, you should pass override_main_response_version to the advanced options to enable compatibility mode.

Example:

Resources:
  OpenSearchServiceDomain:
    Type: AWS::OpenSearchService::Domain
    Properties:
      DomainName: 'test'
      EngineVersion: 'OpenSearch_1.0'
      AdvancedOptions:
        override_main_response_version: true
2
AWS PS On

You can add this in the advanced section tab AdvancedOptions.

Example:

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

0
Damo On

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