Search code examples
aws-cloudformationamazon-elasticsearchopensearch

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

  • 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