Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refresh AWS credentials if marked as expired #634

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hellopatrick
Copy link

@hellopatrick hellopatrick commented Oct 7, 2022

#597 adds support for AWS OpenSearch instances, but the credentials may expire if using the EC2 metadata endpoint (IMDS) to fetch credentials for signing.

As such, before sending request, we should check if the credentials have expired and refresh if need be.

Signed-off-by: Patrick Rogers <hellopatrick@users.noreply.github.com>
Signed-off-by: Patrick Rogers <hellopatrick@users.noreply.github.com>
Signed-off-by: Patrick Rogers <hellopatrick@users.noreply.github.com>
@hellopatrick
Copy link
Author

I believe this also fixes #624, which I'm experiencing as well. After a certain amount of time, the temporary credentials fetched from IMDS expire and just get 403s afterwards.

@hellopatrick
Copy link
Author

Hi, @sysadmind, would it be possible get a look/review? Thanks!

sysadmind added a commit to sysadmind/elasticsearch_exporter that referenced this pull request Oct 17, 2022
Use the AWS cached credential provider to automatically handle credentials. The CredentialsCache will automatically handle refreshing expired credentials and keeping them cached as long as necessary.

Replaces prometheus-community#634 as this offloads more of the work to the AWS SDK

Signed-off-by: Joe Adams <github@joeadams.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant