Spring Cloud Config Server 支持将 AWS Secrets Manager 作为配置属性的后端。 您可以通过向适用于 Secrets Manager 的 AWS Java 开发工具包添加依赖项来启用此功能。Spring中文文档

pom.xml
<dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>secretsmanager</artifactId>
</dependency>

以下配置使用 AWS Secrets Manager 客户端访问密钥。Spring中文文档

spring:
  profiles:
  	active: awssecretsmanager
  cloud:
    config:
      server:
        aws-secretsmanager:
          region: us-east-1
          endpoint: https://us-east-1.console.aws.amazon.com/
          origin: aws:secrets:
          prefix: /secret/foo
          profileSeparator: _

AWS Secrets Manager API 凭证是使用默认凭证提供程序链确定的。Spring中文文档

  • 默认情况下未指定应用程序,未指定配置文件时使用配置文件。applicationdefaultSpring中文文档

  • 当设置为 时,将忽略 和 属性。labeldefaultLabelignoreLabeltrueSpring中文文档

  • 默认情况下未指定应用程序,未指定配置文件时使用配置文件。applicationdefaultSpring中文文档

  • 当设置为 时,将忽略 和 属性。labeldefaultLabelignoreLabeltrueSpring中文文档