Opensearch (cdklocal) deploy failed

Deploying the following simple Opensearch domain with cdklocal results in an error.

What could be the issue?

code:

import * as cdk from 'aws-cdk-lib'
import * as opensearch from "aws-cdk-lib/aws-opensearchservice";

export class CdkStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);
    // opensearch
    new opensearch.Domain(this, 'Domain', {
      version: opensearch.EngineVersion.OPENSEARCH_2_11,
      domainName: 'my-domain',
      capacity: {
        masterNodes: 3,
        dataNodes: 3,
      },
      zoneAwareness: {
        availabilityZoneCount: 2,
      },
      ebs: {
        volumeSize: 10,
      },
    });

  }
}

error:

$ cdklocal deploy --debug
^[[B
✨  Synthesis time: 3.86s

CdkStack:  start: Building b738978eb67f451101bcab4618949eea53b8c4f77fea57a432943d3ecf1c4122:current_account-current_region
CdkStack:  success: Built b738978eb67f451101bcab4618949eea53b8c4f77fea57a432943d3ecf1c4122:current_account-current_region
CdkStack:  start: Publishing b738978eb67f451101bcab4618949eea53b8c4f77fea57a432943d3ecf1c4122:current_account-current_region
CdkStack:  success: Published b738978eb67f451101bcab4618949eea53b8c4f77fea57a432943d3ecf1c4122:current_account-current_region
CdkStack: deploying... [1/1]
CdkStack: creating CloudFormation changeset...
8:10:10 AM | CREATE_FAILED        | AWS::OpenSearchService::Domain | Domain66AC69E0
Could not perform deploy loop action

        new Domain (/workspaces/wealth-management-poc/app/cdk/node_modules/aws-cdk-lib/aws-opensearchservice/lib/domain.js:1:19856)
        \_ new CdkStack (/workspaces/wealth-management-poc/app/cdk/lib/cdk-stack.ts:8:5)
        \_ Object.<anonymous> (/workspaces/wealth-management-poc/app/cdk/bin/cdk.ts:6:1)
        \_ Module._compile (node:internal/modules/cjs/loader:1376:14)
        \_ Module.m._compile (/workspaces/wealth-management-poc/app/cdk/node_modules/ts-node/src/index.ts:1618:23)
        \_ Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
        \_ Object.require.extensions.<computed> [as .ts] (/workspaces/wealth-management-poc/app/cdk/node_modules/ts-node/src/index.ts:1621:12)
        \_ Module.load (node:internal/modules/cjs/loader:1207:32)
        \_ Function.Module._load (node:internal/modules/cjs/loader:1023:12)
        \_ Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
        \_ phase4 (/workspaces/wealth-management-poc/app/cdk/node_modules/ts-node/src/bin.ts:649:14)
        \_ bootstrap (/workspaces/wealth-management-poc/app/cdk/node_modules/ts-node/src/bin.ts:95:10)
        \_ main (/workspaces/wealth-management-poc/app/cdk/node_modules/ts-node/src/bin.ts:55:10)
        \_ Object.<anonymous> (/workspaces/wealth-management-poc/app/cdk/node_modules/ts-node/src/bin.ts:800:3)
        \_ Module._compile (node:internal/modules/cjs/loader:1376:14)
        \_ Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
        \_ Module.load (node:internal/modules/cjs/loader:1207:32)
        \_ Function.Module._load (node:internal/modules/cjs/loader:1023:12)
        \_ Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
        \_ node:internal/main/run_main_module:28:49


 ❌  CdkStack failed: Error: The stack named CdkStack failed to deploy: CREATE_FAILED (Could not perform deploy loop action): Could not perform deploy loop action
    at FullCloudFormationDeployment.monitorDeployment (/usr/local/share/nvm/versions/node/v20.10.0/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:523:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.deployStack2 [as deployStack] (/usr/local/share/nvm/versions/node/v20.10.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:288:24)
    at /usr/local/share/nvm/versions/node/v20.10.0/lib/node_modules/aws-cdk/lib/util/work-graph.ts:105:11

 ❌ Deployment failed: Error: The stack named CdkStack failed to deploy: CREATE_FAILED (Could not perform deploy loop action): Could not perform deploy loop action
    at FullCloudFormationDeployment.monitorDeployment (/usr/local/share/nvm/versions/node/v20.10.0/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:523:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.deployStack2 [as deployStack] (/usr/local/share/nvm/versions/node/v20.10.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:288:24)
    at /usr/local/share/nvm/versions/node/v20.10.0/lib/node_modules/aws-cdk/lib/util/work-graph.ts:105:11

The stack named CdkStack failed to deploy: CREATE_FAILED (Could not perform deploy loop action): Could not perform deploy loop action

I have identified the cause of the error.

Simply put, localstack is only compatible with up to OPENSEARCH_2_9 :smiling_face_with_tear:

Hi @enom,

Could you please create a GitHub issue?

New Issue · localstack/localstack (github.com)

Hi — We have a fix in review: add opensearch 2.10 and 2.11 by HarshCasper · Pull Request #9935 · localstack/localstack · GitHub

1 Like

Hi,
Sorry, I missed the post. Thank you for the correction!

Hi @enom!
We just merged the PR which adds support for OpenSearch 2.11.
This will land in the latest images with the next Docker images pushes (sometime today).
So your issue should be resolved in the upcoming images. :slight_smile:

1 Like