-
Notifications
You must be signed in to change notification settings - Fork 369
Add ability to configure your own AWSCredentialsProvider #102
Comments
It also seems that the documentation is not in line with the behavior - the documentation state at http://cloud.spring.io/spring-cloud-aws/spring-cloud-aws.html states: "The The |
Bump. |
I'm not one of the authors, @Qvazar - it seems that there's no way to avoid it registering a credentials provider factory in the bean registry with a certain name - but it seems like you can at least get it to not use that provider chain by making your own and marking it as Try doing something like this: @Bean
@Primary
public AWSCredentialsProvider awsCredentialsProvider() {
return new DefaultAWSCredentialsProviderChain();
} The (In #170 I have a patch that would make this thing use the |
That seems to work great, thank you @ryangardner ! |
I also had to name the bean |
Sincere request to maintainers @spencergibb to provide a way to allow to use custom awsCredentialsProvider, much more required with @Profile support for different work env |
@rverma-nikiai this is a community maintained project, it is currently assigned to @aemruli |
In case anyone still stumbles upon this and needs Default AWS chain, there is an option now to use it. Just set |
Responding to the above comment - I had already set the above property and still needed to manually inject a @primary default chain to get the default chain to be used. |
This is part of the configuration for shipping metrics to cloudwatch. By default the library seems to look for profiles on the filesystem, which doesn't work with docker. However the AWS client library ships with a DefaultAWSCredentialProviderChain which seems to do the right thing. See spring-attic/spring-cloud-aws#102 The environment variables needed are AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Note that when running locally, we need to pass these environment variables to docker-compose.
This is part of the configuration for shipping metrics to cloudwatch. By default the library seems to look for profiles on the filesystem, which doesn't work with docker. However the AWS client library ships with a DefaultAWSCredentialProviderChain which seems to do the right thing. See spring-attic/spring-cloud-aws#102 The environment variables needed are AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Note that when running locally, we need to pass these environment variables to docker-compose.
Fixed in ee77901 |
You can provide custom credentials provider bean, it just has to have specific name: @Bean(name = CredentialsProviderFactoryBean.CREDENTIALS_PROVIDER_BEAN_NAME)
AWSCredentialsProvider awsCredentialsProvider() {
return mock(AWSCredentialsProvider.class);
} Where |
I was unable to get this to work in auto-configuration without still resorting to |
The Spring boot auto configuration will always register an AWSCredentialsProvider making it impossible to register your own.
Adding a conditional to ContextCredentialsAutoConfiguration
would allow for something like
The text was updated successfully, but these errors were encountered: