elasticsearch_exporter
elasticsearch_exporter copied to clipboard
fix: refresh AWS credentials if marked as expired
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.
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.
Hi, @sysadmind, would it be possible get a look/review? Thanks!