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