Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.
This repository was archived by the owner on May 23, 2025. It is now read-only.

IAM-Role Authentication #17

@dor15

Description

@dor15

Description:
I tried to use IAM-Role authentication, and I think you missed the part of
session = boto3.Session() credentials = session.get_credentials()

before the initialization of
aws_region = os.getenv("AWS_REGION", "") aws_access_key = os.getenv("AWS_ACCESS_KEY", "") aws_secret_access_key = os.getenv("AWS_SECRET_ACCESS_KEY", "") aws_session_token = os.getenv("AWS_SESSION_TOKEN", "")

It seems like the code "forces" you to put the variables as ENV variables rather than pulling them from the role itself.

This is how I implemented it to make it work with role-based auth:

session = boto3.Session() credentials = session.get_credentials() opensearch_url = "https://xxx.amazon.com" aws_region = "eu-west-1" aws_access_key = credentials.access_key aws_secret_access_key = credentials.secret_key aws_session_token = credentials.token

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions