elasticsearch_exporter icon indicating copy to clipboard operation
elasticsearch_exporter copied to clipboard

fix: refresh AWS credentials if marked as expired

Open hellopatrick opened this issue 2 years ago • 2 comments

https://github.com/prometheus-community/elasticsearch_exporter/pull/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.

hellopatrick avatar Oct 07 '22 02:10 hellopatrick

I believe this also fixes https://github.com/prometheus-community/elasticsearch_exporter/issues/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 avatar Oct 07 '22 02:10 hellopatrick

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

hellopatrick avatar Oct 10 '22 22:10 hellopatrick