1

我正在尝试在 ECS 生成的 docker 容器中运行 spring 云配置应用程序。我在正确设置时遇到问题,以便使用元数据从 CodeCommit 克隆 git repo

我有以下设置

pom.xml 依赖项

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-aws</artifactId>
</dependency>

应用程序.yml

# some other non related settings such as port
spring:
  cloud:
    config:
      server:
        git:
          uri: https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/<repo name>
          skip-ssl-validation: true
cloud:
  aws:
    credentials:
      instance-profile: true
    stack:
      auto: false

在 docker 日志中,我可以找到以下内容

2019-04-25 16:37:54.209  WARN 1 --- [nio-5000-exec-1] .c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory.

org.eclipse.jgit.api.errors.TransportException: https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/<repo name>: git-upload-pack not permitted on 'https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/<repo name>/'

如果我正确理解这一点;根据 spring cloud config 文档,当您使用 CodeCommit git url 并且不指定用户名和密码时,它应该自动默认为 AWS Credentials Chain,它具有实例配置文件凭证作为最终选项。

If you provide a username and password with an AWS CodeCommit URI, they must be the AWS accessKeyId and secretAccessKey that provide access to the repository.
If you do not specify a username and password, the accessKeyId and secretAccessKey are retrieved by using the AWS Default Credential Provider Chain.
4

0 回答 0