AWS S3 后端
Spring Cloud Config Server 支持将 AWS S3 作为配置属性的后端存储。你可以通过添加 AWS Java SDK For Amazon S3 依赖来启用此功能。
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
</dependencies>
以下配置使用 AWS S3 客户端来访问配置文件。我们可以使用 spring.cloud.config.server.awss3.*
属性来选择存储配置的存储桶。
spring:
profiles:
active: awss3
cloud:
config:
server:
awss3:
region: us-east-1
bucket: bucket1
也可以通过指定一个 AWS URL 来覆盖标准的端点,使用 spring.cloud.config.server.awss3.endpoint
来覆盖 S3 服务的标准端点。这允许支持 S3 的测试区域以及其他与 S3 兼容的存储 API。
凭证通过默认凭证提供者链找到。支持版本化和加密的存储桶,无需进一步配置。
配置文件以 {application}-{profile}.properties
、{application}-{profile}.yml
或 {application}-{profile}.json
的形式存储在您的存储桶中。可以提供一个可选的标签来指定文件的目录路径。
备注
当未指定配置文件时,将使用 default
。