0

我已经通过elasticsearch.rb初始化器设置了以下 aws_credentials。

  Searchkick.aws_credentials = {
    credentials: Aws::InstanceProfileCredentials.new.credentials,
    region: 'us-west-2',
  }

这在我第一次重新部署时工作正常,但 12 小时后,我的凭据过期,我最终遇到了一堆这些错误:

Elasticsearch::Transport::Transport::Errors::Forbidden ([403] {"message":"The security token included in the request is expired"})

这是有道理的,因为我的一组凭据的到期时间似乎是 12 小时。Aws::InstanceProfileCredentials.new.expiration = 2020-02-13 21:36:30 UTC

鉴于我想继续轮换凭据,我如何让 Searchkick 为每个请求提取最新的凭据?

4

1 回答 1

0

传递整个Aws::InstanceProfileCredentials固定这个

  Searchkick.aws_credentials = {
    credentials: Aws::InstanceProfileCredentials.new,
    region: 'us-west-2',
  }
于 2020-03-06T19:19:38.367 回答