diff --git a/lib/infra/infra-stack.ts b/lib/infra/infra-stack.ts index c9d260dc2d1..00e0d5760ca 100644 --- a/lib/infra/infra-stack.ts +++ b/lib/infra/infra-stack.ts @@ -483,10 +483,6 @@ export class InfraStack extends Stack { cwd: '/home/ec2-user', ignoreErrors: false, })); - cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch;sudo -u ec2-user bin/opensearch-plugin install repository-s3 --batch', { - cwd: '/home/ec2-user', - ignoreErrors: false, - })); } else { cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch;sudo -u ec2-user bin/opensearch-plugin install ' + `https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${props.opensearchVersion}/latest/linux/${props.cpuArch}` @@ -494,12 +490,6 @@ export class InfraStack extends Stack { cwd: '/home/ec2-user', ignoreErrors: false, })); - cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch;sudo -u ec2-user bin/opensearch-plugin install ' - + `https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${props.opensearchVersion}/latest/linux/${props.cpuArch}` - + `/tar/builds/opensearch/core-plugins/repository-s3-${props.opensearchVersion}.zip --batch`, { - cwd: '/home/ec2-user', - ignoreErrors: false, - })); } if (props.enableRemoteStore) { @@ -535,6 +525,20 @@ export class InfraStack extends Stack { } } + if (props.distributionUrl.includes('artifacts.opensearch.org') && !props.minDistribution) { + cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch;sudo -u ec2-user bin/opensearch-plugin install repository-s3 --batch', { + cwd: '/home/ec2-user', + ignoreErrors: false, + })); + } else { + cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch;sudo -u ec2-user bin/opensearch-plugin install ' + + `https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${props.opensearchVersion}/latest/linux/${props.cpuArch}` + + `/tar/builds/opensearch/core-plugins/repository-s3-${props.opensearchVersion}.zip --batch`, { + cwd: '/home/ec2-user', + ignoreErrors: false, + })); + } + // add config to disable security if required if (props.securityDisabled && !props.minDistribution) { // eslint-disable-next-line max-len