Search code examples
javaspring-bootspring-cloud-streamamazon-kinesis

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


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?


Solution

  • 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.