Repository_exception - repository type [s3] does not exist

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

Hi All,

I am using Localstack to set up AWS environment in my Test project (Java-maven) and creating an S3 bucket. Also I have installed repository-s3 on the localstack container as well.
Also, I am using OpenSearch Highlevel client using Opensearch Docker
(DockerImageName DOCKER_IMAGE_NAME = DockerImageName
.parse(“opensearchproject/opensearch”)
.withTag(“2.9.0”):wink:
to create a repository of type S3 as below

String repositoryName = “newsflo-opensearch-snapshot”;
PutRepositoryRequest request = new PutRepositoryRequest(repositoryName);
request.type(“s3”);
request.settings(Settings.builder()
.put(“bucket”, bucketName)
.build());


    AcknowledgedResponse response = null;
    try {
        response = openSearchClient.snapshot().createRepository(request, RequestOptions.DEFAULT);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

I get the error as below

OpenSearchStatusException[OpenSearch exception [type=repository_exception, reason=[newsflo-opensearch-snapshot] repository type [s3] does not exist]]

Could anyone please help me to create repository of type s3 ? Am i missing anything please help

Describe the issue:

Configuration:

Relevant Logs or Screenshots:

	at org.opensearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:207)
	at org.opensearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2228)
	at org.opensearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:2205)
	at org.opensearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1924)
	at org.opensearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1877)
	at org.opensearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1845)
	at org.opensearch.client.SnapshotClient.createRepository(SnapshotClient.java:123)
	at com.elsevier.rdp.newsflo.bdd.steps.StepsDefinitions.createSBucketToStoreTheOpenSearchIndexSnapshot(StepsDefinitions.java:108)```

You can check whether repository-s3 plugin is installed or not:

GET _cat/plugins

, note that the plugin should be installed on every node.

Hi @gaobinlong thanks for your suggestion. I have installed the plugins and restarted the container and checked whether repository-s3 plugin is available or not. Yes it is available. However when i
Create a repository using below lines of code

PutRepositoryRequest request = new PutRepositoryRequest(repositoryName);
        request.type("s3");
        request.settings(Settings.builder()
                .put("bucket", bucketName)
                .put("region", LOCALSTACK.getRegion())
                .put("client.access_key", LOCALSTACK.getAccessKey())
                .put("client.secret_key", LOCALSTACK.getSecretKey())
                .put("base_path", "/")
                .put("endpoint", "http://host.docker.internal:" + LOCALSTACK.getEndpointOverride(LocalStackContainer.Service.S3).getPort())
                .build());
        try {
            openSearchClient.snapshot().createRepository(request, RequestOptions.DEFAULT);
        } catch (Exception e) {
            log.warn("{}", e.getMessage());
        }

I get below exception . Any suggestions please, I followed the documentation

2024-02-26 10:28:36 org.opensearch.repositories.RepositoryVerificationException: [newsflo-housekeeper-lambda-snapshot-repo] path is not accessible on cluster-manager node
2024-02-26 10:28:36 at org.opensearch.repositories.blobstore.BlobStoreRepository.startVerification(BlobStoreRepository.java:1970) ~[opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 at org.opensearch.repositories.RepositoriesService$3.doRun(RepositoriesService.java:373) ~[opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:908) [opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) [opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
2024-02-26 10:28:36 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
2024-02-26 10:28:36 at java.lang.Thread.run(Thread.java:833) [?:?]
2024-02-26 10:28:36 Caused by: java.io.IOException: Unable to upload object [tests-pOfcKCugRHWglPpiuDJqug/master.dat] using a single upload
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.executeSingleUpload(S3BlobContainer.java:545) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$writeBlob$1(S3BlobContainer.java:181) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedIOException(SocketAccess.java:61) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlob(S3BlobContainer.java:179) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlobAtomic(S3BlobContainer.java:282) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.blobstore.BlobStoreRepository.startVerification(BlobStoreRepository.java:1962) ~[opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 … 6 more
2024-02-26 10:28:36 Caused by: software.amazon.awssdk.core.exception.SdkClientException: Failed to load credentials from IMDS.
2024-02-26 10:28:36 at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:111) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.exception.SdkClientException.create(SdkClientException.java:47) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.refreshCredentials(InstanceProfileCredentialsProvider.java:157) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.lambda$jitteredPrefetchValueSupplier$3(CachedSupplier.java:284) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.NonBlocking.fetch(NonBlocking.java:141) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.refreshCache(CachedSupplier.java:199) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.get(CachedSupplier.java:128) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.resolveCredentials(InstanceProfileCredentialsProvider.java:139) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivileged(SocketAccess.java:55) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3Service$PrivilegedInstanceProfileCredentialsProvider.resolveCredentials(S3Service.java:471) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.util.MetricUtils.measureDuration(MetricUtils.java:50) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.resolveCredentials(AwsCredentialsAuthorizationStrategy.java:100) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.addCredentialsToExecutionAttributes(AwsCredentialsAuthorizationStrategy.java:77) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.AwsExecutionContextBuilder.invokeInterceptorsAndCreateExecutionContext(AwsExecutionContextBuilder.java:123) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.invokeInterceptorsAndCreateExecutionContext(AwsSyncClientHandler.java:69) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:78) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:179) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.services.s3.DefaultS3Client.putObject(DefaultS3Client.java:9324) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$executeSingleUpload$27(S3BlobContainer.java:542) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.lambda$doPrivilegedVoid$0(SocketAccess.java:70) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedVoid(SocketAccess.java:69) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.executeSingleUpload(S3BlobContainer.java:541) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$writeBlob$1(S3BlobContainer.java:181) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedIOException(SocketAccess.java:61) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlob(S3BlobContainer.java:179) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlobAtomic(S3BlobContainer.java:282) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.blobstore.BlobStoreRepository.startVerification(BlobStoreRepository.java:1962) ~[opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 … 6 more
2024-02-26 10:28:36 Caused by: java.io.UncheckedIOException: java.net.ConnectException: Connection refused
2024-02-26 10:28:36 at software.amazon.awssdk.utils.FunctionalUtils.asRuntimeException(FunctionalUtils.java:180) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.FunctionalUtils.lambda$safeSupplier$4(FunctionalUtils.java:110) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.FunctionalUtils.invokeSafely(FunctionalUtils.java:136) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.getSecurityCredentials(InstanceProfileCredentialsProvider.java:254) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.createEndpointProvider(InstanceProfileCredentialsProvider.java:202) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.refreshCredentials(InstanceProfileCredentialsProvider.java:148) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.lambda$jitteredPrefetchValueSupplier$3(CachedSupplier.java:284) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.NonBlocking.fetch(NonBlocking.java:141) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.refreshCache(CachedSupplier.java:199) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.get(CachedSupplier.java:128) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.resolveCredentials(InstanceProfileCredentialsProvider.java:139) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivileged(SocketAccess.java:55) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3Service$PrivilegedInstanceProfileCredentialsProvider.resolveCredentials(S3Service.java:471) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.util.MetricUtils.measureDuration(MetricUtils.java:50) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.resolveCredentials(AwsCredentialsAuthorizationStrategy.java:100) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.addCredentialsToExecutionAttributes(AwsCredentialsAuthorizationStrategy.java:77) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.AwsExecutionContextBuilder.invokeInterceptorsAndCreateExecutionContext(AwsExecutionContextBuilder.java:123) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.invokeInterceptorsAndCreateExecutionContext(AwsSyncClientHandler.java:69) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:78) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:179) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.services.s3.DefaultS3Client.putObject(DefaultS3Client.java:9324) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$executeSingleUpload$27(S3BlobContainer.java:542) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.lambda$doPrivilegedVoid$0(SocketAccess.java:70) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedVoid(SocketAccess.java:69) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.executeSingleUpload(S3BlobContainer.java:541) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$writeBlob$1(S3BlobContainer.java:181) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedIOException(SocketAccess.java:61) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlob(S3BlobContainer.java:179) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlobAtomic(S3BlobContainer.java:282) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.blobstore.BlobStoreRepository.startVerification(BlobStoreRepository.java:1962) ~[opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 … 6 more
2024-02-26 10:28:36 Caused by: java.net.ConnectException: Connection refused
2024-02-26 10:28:36 at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
2024-02-26 10:28:36 at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
2024-02-26 10:28:36 at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:554) ~[?:?]
2024-02-26 10:28:36 at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:602) ~[?:?]
2024-02-26 10:28:36 at java.net.Socket.connect(Socket.java:633) ~[?:?]
2024-02-26 10:28:36 at sun.net.NetworkClient.doConnect(NetworkClient.java:178) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.http.HttpClient.openServer(HttpClient.java:533) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.http.HttpClient.openServer(HttpClient.java:638) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.http.HttpClient.(HttpClient.java:281) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.http.HttpClient.New(HttpClient.java:386) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.http.HttpClient.New(HttpClient.java:408) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1287) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128) ~[?:?]
2024-02-26 10:28:36 at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.regions.internal.util.ConnectionUtils.connectToEndpoint(ConnectionUtils.java:45) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.regions.util.HttpResourcesUtils.readResource(HttpResourcesUtils.java:112) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.regions.util.HttpResourcesUtils.readResource(HttpResourcesUtils.java:91) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.lambda$getSecurityCredentials$3(InstanceProfileCredentialsProvider.java:254) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.FunctionalUtils.lambda$safeSupplier$4(FunctionalUtils.java:108) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.FunctionalUtils.invokeSafely(FunctionalUtils.java:136) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.getSecurityCredentials(InstanceProfileCredentialsProvider.java:254) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.createEndpointProvider(InstanceProfileCredentialsProvider.java:202) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.refreshCredentials(InstanceProfileCredentialsProvider.java:148) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.lambda$jitteredPrefetchValueSupplier$3(CachedSupplier.java:284) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.NonBlocking.fetch(NonBlocking.java:141) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.refreshCache(CachedSupplier.java:199) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.utils.cache.CachedSupplier.get(CachedSupplier.java:128) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.resolveCredentials(InstanceProfileCredentialsProvider.java:139) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivileged(SocketAccess.java:55) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3Service$PrivilegedInstanceProfileCredentialsProvider.resolveCredentials(S3Service.java:471) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.util.MetricUtils.measureDuration(MetricUtils.java:50) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.resolveCredentials(AwsCredentialsAuthorizationStrategy.java:100) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.addCredentialsToExecutionAttributes(AwsCredentialsAuthorizationStrategy.java:77) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.internal.AwsExecutionContextBuilder.invokeInterceptorsAndCreateExecutionContext(AwsExecutionContextBuilder.java:123) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.invokeInterceptorsAndCreateExecutionContext(AwsSyncClientHandler.java:69) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:78) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:179) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56) ~[?:?]
2024-02-26 10:28:36 at software.amazon.awssdk.services.s3.DefaultS3Client.putObject(DefaultS3Client.java:9324) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$executeSingleUpload$27(S3BlobContainer.java:542) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.lambda$doPrivilegedVoid$0(SocketAccess.java:70) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedVoid(SocketAccess.java:69) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.executeSingleUpload(S3BlobContainer.java:541) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.lambda$writeBlob$1(S3BlobContainer.java:181) ~[?:?]
2024-02-26 10:28:36 at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.SocketAccess.doPrivilegedIOException(SocketAccess.java:61) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlob(S3BlobContainer.java:179) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.s3.S3BlobContainer.writeBlobAtomic(S3BlobContainer.java:282) ~[?:?]
2024-02-26 10:28:36 at org.opensearch.repositories.blobstore.BlobStoreRepository.startVerification(BlobStoreRepository.java:1962) ~[opensearch-2.11.0.jar:2.11.0]
2024-02-26 10:28:36 … 6 more

I installed the plugin and restarted OpenSearch docker container and I can see repository-s3 plugin is available. However, when I create a repository using below code

PutRepositoryRequest request = new PutRepositoryRequest(repositoryName);
request.type(“s3”);
request.settings(builder()
.put(“bucket”, bucketName)
.put(“region”, LOCALSTACK.getRegion())
.put(“base_path”, “/”)
.put(“endpoint”, “http://host.docker.internal:” + LOCALSTACK.getEndpointOverride(LocalStackContainer.Service.S3).getPort())
.build());
try {
openSearchClient.snapshot().createRepository(request, RequestOptions.DEFAULT);
} catch (Exception e) {
log.warn(“{}”, e.getMessage());
}

I get an error as below

OpenSearchStatusException[OpenSearch exception [type=repository_verification_exception, reason=[newsflo-housekeeper-lambda-snapshot-repo] path is not accessible on cluster-manager node]]; nested: OpenSearchException[OpenSearch exception [type=i_o_exception, reason=Unable to upload object [tests-jGV-KdnHSLemDqapJ7I5AQ/master.dat] using a single upload]]; nested: OpenSearchException[OpenSearch exception [type=sdk_client_exception, reason=Failed to load credentials from IMDS.]]; nested: OpenSearchException[OpenSearch exception [type=unchecked_i_o_exception, reason=java.net.SocketTimeoutException: Connect timed out]]; nested: OpenSearchException[OpenSearch exception [type=socket_timeout_exception, reason=Connect timed out]];

I would like to explain the context of the above error. I am trying to run my test suite with the following pre-requisite,s where I need an S3 bucket and Opensearch cluster so that I can create a Repository of type S3 (mention the S3 bucket while creating the repo) and then I need to create a few indices and then I need to take the snapshot to the repository of type S3. Also, I wanted to run this test on my Jenkins pipeline. So my plan is to bring up LocalStack docker container to create S3 and Opensearch docker container to bring up the Opensearch Cluster. Also using RestHighLevelClient I will connect with the cluster for different operations like create repo, take snapshot etc. SO the catch here is the S3 I am referring to is the S3 bucket created in the LocalStack not the actual AWS S3. Can anyone please review this and confirm whether this is possible ?