I have an OpenSearch domain set up within a VPC, and there is an EC2 instance running in the same VPC. The EC2 instance has an IAM role attached to its instance profile, granting full permissions to access the OpenSearch domain. However, when attempting to read or write to the domain from the EC2 instance, a 401 Unauthorized error is encountered.
For example
I can do whatever I wish with OpenSearch domain using aws cli on this ec2. for example
aws opensearch upgrade-domain --domain-name opensearch-blui --target-version OpenSearch_2.5
works but when I try to create an index in the cluster, it fails.
curl -XPUT https://opensearch.lol.net/movies/_doc/1 -d '{"director": "Burton, Tim", "genre": ["Comedy","Sci-Fi"], "year": 1996, "actor": ["Jack Nicholson","Pierce Brosnan","Sarah Jessica Parker"], "title": "Mars Attacks!"}' -H 'Content-Type: application/json'
Unauthorized
Is it not possible to use IAM to authenticate with Opensearch to make actual use of it?