- Newest
- Most votes
- Most comments
The 403 error you're encountering with OpenSearch Serverless is due to missing IAM permissions, even though you've set up the Data Access Policy correctly.
For OpenSearch Serverless, having a Data Access Policy that includes your IAM principal (user/role) is necessary but not sufficient. You also need to ensure that the IAM identity you're using has two specific IAM permissions:
aoss:APIAccessAll- For accessing OpenSearch Serverless data plane APIsaoss:DashboardsAccessAll- For accessing OpenSearch Dashboards
Without these permissions, you'll continue to receive 403 errors even if your principal is listed in the Data Access Policy.
To fix this issue:
- Attach an IAM policy to your user or role that includes these permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"aoss:APIAccessAll",
"aoss:DashboardsAccessAll"
],
"Resource": "*"
}
]
}
- After adding these permissions, your boto3 script should be able to connect successfully.
If you continue to experience issues after adding these permissions, verify that your AWS credentials are correct and that your network policy allows access from your location (public access or VPC endpoint as appropriate).
Sources
Troubleshoot OpenSearch Serverless errors | AWS re:Post
Data access control for Amazon OpenSearch Serverless - Amazon OpenSearch Service
AuthorizationException(403, 'security_exception', 'OpenSearch exception [type=authorization_exception, reason=User does not have permissions for the requested resource] same issue here
Relevant content
- asked a month ago
