Issues setting up s3 bucket for snapshot repository using IAM Role

I’m trying to setup an s3 bucket snapshot repository, using IAM roles to allow access to the bucket. I am unable to get the repository setup to complete, it gives this error:

        "reason" : "sdk_client_exception: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), WebIdentityTokenCredentialsProvider: You must specify a value for roleArn and roleSessionName, com.amazonaws.auth.profile.ProfileCredentialsProvider@6669063f: access denied (\"\" \"/usr/share/opensearch/.aws/credentials\" \"read\"), com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@2ab72ee2: Failed to connect to service endpoint: ]"

I have added the Role ARN and Role Session Name in multiple ways, environment variables, in the opensearch keystore, defining the role in the request to create the repository, etc.

No matter how I define the role information, I keep getting the same error, and the repository setup will not complete.

Any ideas what I might be missing to get this to work? The opensearch cluster is running on AWS ECS.

@tfmm could you please share a) what OpenSearch version you are running b) what settings you are using to configure IAM? Thank you.

Opensearch 2.2.0, built off the official docker image, just with our certificates and such added.

As far as IAM Settings, the role has complete control over the bucket, and I have confirmed that awscli commands to upload / otherwise interact with the bucket work from the container. I’ll include the full policy below.

    "Version": "2012-10-17",
    "Statement": [
            "Action": [
            "Effect": "Allow",
            "Resource": [
            "Effect": "Allow",
      "Action": [

            "Resource": [

I just realized you may be asking for what opensearch settings I’m using to configure IAM. I have tried multiple:

Keystore entries:


Environment variables:


And several combinations of these. I attempted to follow the instructions here: Take and restore snapshots - OpenSearch documentation

But am still having no luck.

Thanks @tfmm, the steps / settings are looking right, I suspect that the keystore you are configuring is not being picked by OpenSearch, could you please confirm that is / is not the case?

@reta could you give me a hand knowing how to confirm if the keystore is being picked up?

It should be in the folder pointed by OPENSEARCH_PATH_CONF, the exact location of this folder is available in logs, the server prints it on startup. Thank you.

Thanks. So the keystore is in the config path specified on startup:

[2022-09-26T15:54:46,830][INFO ][o.o.s.OpenSearchSecurityPlugin] [] OpenSearch Config path is /usr/share/opensearch/config

[opensearch@ config]$ pwd
[opensearch@ config]$ ls -lah *.keystore
-rw-rw---- 1 opensearch opensearch 335 Sep 26 15:54 opensearch.keystore
[opensearch@ config]$ opensearch-keystore list

Thanks @tfmm, kystore is looking right, do you mind please to share the stack trace from OpenSearch logs relevant to S3 credentials issue, it would help to identify path being taken for credentials resolution, thank you.