Open simpledev123 opened 1 year ago
I have the exact same code working in https://github.com/dblock/opensearch-java-client-demo and was able to cat indices (I do have different IAM role/permissions, but you already verified that it works with other clients). Let's see if this is something in the setup of your application? Try running my demo without changes, does it work or do you get the same error?
I have tried the same code. Only change was that I didn't pass the credentials in environment variable. It was picked up by default credential chain from IAM role attached. It didn't work.
@simpledev123 Have you tried the demo or the same code? Check out, and try running running the demo? Instructions in README. Since the code is identical I suspect some other problem.
Steps to reproduce:
Attach an IAM role with all permissions.
**aoss:CreateCollectionItems aoss:DeleteCollectionItems aoss:UpdateCollectionItems aoss:DescribeCollectionItems
aoss:CreateIndex aoss:DeleteIndex aoss:UpdateIndex aoss:DescribeIndex aoss:ReadDocument aoss:WriteDocument**
Run below Java class within a container.
AWS supplies session access & secret ids along with session token. That will get printed. But final result would be a 403 error with message "authentication/authorization failure".
This not a permission issue in IAM role. If we pass access key & secret key (generate with same permissions) in environment variable, the client works fine.
Also Python opensearch-py library works just fine within the same container with session credentials from same IAM role.
Python code:
Have anyone faced this issue while accessing OpenSearch serverless with opensearch-java 2.2.0? Is there any workaround or planned fix?