AWS S3 Backend
Spring Cloud Config Server 支持 AWS S3 作为配置属性的后端。您可以通过将依赖项添加到 AWS Java SDK For Amazon S3来启用此功能。
Spring Cloud Config Server supports AWS S3 as a backend for configuration properties. You can enable this feature by adding a dependency to the 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.*
属性来选择存储配置的存储桶。
The following configuration uses the AWS S3 client to access configuration files. We can use spring.cloud.config.server.awss3.*
properties to select the bucket where your configuration is stored.
spring:
profiles:
active: awss3
cloud:
config:
server:
awss3:
region: us-east-1
bucket: bucket1
您还可以使用 spring.cloud.config.server.awss3.endpoint
为 S3 服务的 override the standard endpoint 指定 AWS URL。这可以让 S3 以及其他与 S3 兼容的存储 API 受支持的 Beta 地区。
It is also possible to specify an AWS URL to override the standard endpoint of your S3 service with spring.cloud.config.server.awss3.endpoint
. This allows support for beta regions of S3, and other S3 compatible storage APIs.
凭据使用 Default Credential Provider Chain来查找。版本化和加密的存储桶在不进行进一步配置的情况下受支持。
Credentials are found using the Default Credential Provider Chain. Versioned and encrypted buckets are supported without further configuration.
配置文件存储在你的存储桶中,格式为 {application}-{profile}.properties
、 {application}-{profile}.yml
或 {application}-{profile}.json
。可以提供可选标签来指定指向文件目录的路径。
Configuration files are stored in your bucket as {application}-{profile}.properties
, {application}-{profile}.yml
or {application}-{profile}.json
. An optional label can be provided to specify a directory path to the file.
如果没有指定配置文件,将使用 |
When no profile is specified |