2
votes

I am trying to use AWS CodeCommit repository with spring cloud config. I have managed to get it working with SSH. But I would like to use https instead of SSH. AWS suggest to use credential helper. Does anyone know how can I configure spring config cloud to use credential helper? I have looked AWS CodeCommit HTTPS access without setting up credential helper But there is no answer yet and I was wondering if there is some way in spring cloud config to do it.

2
How did u manage to use aws codecommit with SSH in Spring Cloud Config ? I am using the property: spring.cloud.config.server.git.uri=ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/<my_repo_name>, but it always got error of USERAUTH failtsukanomon

2 Answers

1
votes

I don't know if you have seen this answer yet, but this explains a little bit and the example with JGit works. AWS CodeCommit HTTPS access without setting up credential helper

Since Spring Cloud Config doesn't yet support adding custom Credential providers you need to implement your own EnvironmentRepository.

For a POC I overrode the JGitEnvironmentRepository, and had to copy almost all the code because what I really needed to override was a private method JGitEnvironmentRepository#setCredentialsProvider. That method is where I used the code from the example I provided above.

Spring Cloud Config uses an auto config to build their MultipleJGitEnvironmentRepository bean and it is annotated with @ConditionalOnMissingBean(EnvironmentRepository.class), so as long as you create a bean of that type you can override their behavior.

So with that said the SSH option is a lot cleaner until Spring expands their support for configuring custom Credential Providers or first class support for CodeCommit.

Open issue for AWS CodeCommit: https://github.com/spring-cloud/spring-cloud-config/issues/334

0
votes

Duplication of a similar question and solution is posted there. AWS CodeCommit HTTPS access without setting up credential helper