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 以 覆寫 S3 服務的標準端點,使用 spring.cloud.config.server.awss3.endpoint。這允許支援 S3 的 Beta 區域和其他 S3 相容的儲存 API。

憑證會使用 預設憑證提供者鏈 尋找。版本化和加密的儲存貯體無需額外組態即可支援。

組態檔案以 {application}-{profile}.properties{application}-{profile}.yml{application}-{profile}.json 格式儲存在您的儲存貯體中。可以提供選用的標籤來指定檔案的目錄路徑。

當未指定 Profile 時,將會使用 default