AWS S3 后端
Spring Cloud Config Server 支持 AWS S3 作为配置属性的后端。您可以通过添加对 AWS Java SDK For Amazon S3 的依赖来启用此功能。
pom.xml
<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
形式存储在您的存储桶中。 可以提供一个可选标签来指定文件的目录路径。
如果未指定 profile,将使用 default 。 |