How to Configure using STSAssumeRoleSessionCredentialsProvider in spring-cloud-stream-binder-kinesis

huangapple go评论89阅读模式
英文:

How to Configure using STSAssumeRoleSessionCredentialsProvider in spring-cloud-stream-binder-kinesis

问题

以下是翻译好的部分:

我正在使用 spring-cloud-stream-binder-kinesis,版本:2.0.2.RELEASE。

我已经成功地使用了 binder,并且可以在本地访问它,使用了 KinesisBinderConfiguration 中提到的默认 ContextCredentialsAutoConfiguration。

现在我知道这个设置对我来说行不通,因为:
Kinesis 数据流位于 AWS 帐户1中
服务正在 AWS 帐户2中运行
(我已经完成了假定角色的设置,以便帐户2可以使用假定角色访问帐户1中的流)

但是我不确定如何覆盖 binder 中的凭证,以使用 STSAssumeRoleSessionCredentialsProvider。

有人可以帮忙吗?

英文:

I am using spring-cloud-stream-binder-kinesis, version: 2.0.2.RELEASE.

I was able to successfully use binder and access it locally using the default ContextCredentialsAutoConfiguration mentioned in the KinesisBinderConfiguration.

Now I know this set-up wont work for me because,
The Kinesis data stream is in AWS account 1
The Service is running in AWS account 2
(I have already done the setup of assumed Role so that Account 2 can access streams in account 1 using the assumed role)

However I am not sure how can I override the credentials in binder to use STSAssumeRoleSessionCredentialsProvider

Can someone help please?

答案1

得分: 0

KinesisBinderConfiguration完全基于Spring Cloud AWS中的自动配置,为我们提供了ContextCredentialsAutoConfiguration,并在尚未存在的情况下公开了名为credentialsProviderAWSCredentialsProviderbean。

因此,您可能只需要在配置类中将您的STSAssumeRoleSessionCredentialsProvider配置为一个bean,并将其指定为credentialsProviderbean的名称。

英文:

The KinesisBinderConfiguration is fully based on the auto-configuration from the Spring Cloud AWS, which provides for us a ContextCredentialsAutoConfiguration and expose an AWSCredentialsProvider bean under the credentialsProvider name if not present yet.

So, probably you just need to have your STSAssumeRoleSessionCredentialsProvider as a bean in your configuration class and give it that credentialsProvider bean name.

huangapple
  • 本文由 发表于 2020年9月23日 02:46:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/64015952.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定