AWS Security Issues

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
I am using the latest version of OS. For security I have used AwsSdk2Transport . Below is the piece of code

return new OpenSearchClient(
                new AwsSdk2Transport(
                        httpClient,
                        HttpHost.create(openSearchEndpoint).getHostName(),
                        OPEN_SEARCH, Region.US_EAST_1,
                        AwsSdk2TransportOptions.builder().setCredentials().build()));

I was assuming this will internally uses InstanceProfileCredentialsProvider if there isno environment AWS credentials provided. But its not, I am getting error as “java.lang.Exception: org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [security_exception] authentication/authorization failure”.

How can I user InstanceProfileCredentialsProvider using java for authentication (I am using IAM based authentication, so that refreshin token will be taken care by AWS). Please guide me to proceed further.

Describe the issue:

Configuration:

Relevant Logs or Screenshots:

@vmanjunath The OpenSearch can be integrated with AWS Cognito authentication. I’m not aware of such functionality with AWS IAM.