From 7e7d6cf1133b7bd2c0856e7c340b34e1d5b0da89 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Thu, 8 Jun 2023 14:02:03 -0400 Subject: [PATCH] Scope discovery-ec2 IMDS lookups to this cluster formation. (#36) Signed-off-by: dblock --- lib/infra/infra-stack.ts | 4 ++++ lib/opensearch-config/multi-node-base-config.yml | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/infra/infra-stack.ts b/lib/infra/infra-stack.ts index 30a2fdfe025..5cb6489e30f 100644 --- a/lib/infra/infra-stack.ts +++ b/lib/infra/infra-stack.ts @@ -425,6 +425,10 @@ export class InfraStack extends Stack { const baseConfig: any = load(readFileSync(`${configFileDir}/multi-node-base-config.yml`, 'utf-8')); baseConfig['cluster.name'] = `${scope.stackName}-${scope.account}-${scope.region}`; + + // use discovery-ec2 to find manager nodes by querying IMDS + baseConfig['discovery.ec2.tag.Name'] = `${scope.stackName}/seedNodeAsg,${scope.stackName}/managerNodeAsg`; + const commonConfig = dump(baseConfig).toString(); cfnInitConfig.push(InitCommand.shellCommand(`set -ex;cd opensearch; echo "${commonConfig}" > config/opensearch.yml`, { diff --git a/lib/opensearch-config/multi-node-base-config.yml b/lib/opensearch-config/multi-node-base-config.yml index 9236d94c30a..79d68454683 100644 --- a/lib/opensearch-config/multi-node-base-config.yml +++ b/lib/opensearch-config/multi-node-base-config.yml @@ -1,5 +1,4 @@ cluster.name: "opensearch" cluster.initial_cluster_manager_nodes: ["seed"] discovery.seed_providers: ec2 -discovery.ec2.tag.role: manager network.host: 0.0.0.0