如何將 API Gateway REST API 與 Application Load Balancer 整合?

2 分的閱讀內容
0

我想要將 Amazon API Gateway REST API 與 Application Load Balancer 整合。

簡短描述

若要將 Gateway REST API 與公有 Application Load Balancer 整合,請使用 API Gateway HTTP 整合

對於私有 Application Load Balancer,請使用 API Gateway 虛擬私有雲端 (VPC) 連結來先連線至私有 Network Load Balancer。然後,使用 Network Load Balancer 將 API Gateway 請求轉送至私有 Application Load Balancer。

**注意:**對於 REST API,沒有私有 Application Load Balancer 的直接 API Gateway 整合。

解決方法

將 API Gateway REST API 與公有 Application Load Balancer 整合

先決條件:

  • 存取公有 Application Load Balancer 及其 DNS 名稱
  • 含有 HTTP 方法的 API Gateway REST API 資源

請完成下列步驟:

  1. 開啟 API Gateway 主控台
  2. 選擇要與 Application Load Balancer 整合的 API。
  3. 資源下,針對方法選擇 API 使用的 HTTP 方法。
  4. 選擇整合請求
  5. 整合請求下,針對整合類型選擇 HTTP
    **注意:**若要將整個 API 請求及其參數傳遞至後端 Application Load Balancer,請建立 HTTP 代理整合。或者,建立 HTTP 自訂整合。如需詳細資訊,請參閱在 API Gateway 中設定 HTTP 整合
  6. 端點 URL 欄位中,輸入 Application Load Balancer 的預設 DNS 名稱或自訂 DNS 名稱。然後,新增其接聽程式的設定協定。例如,在連接埠 8080 上設定了 HTTPS 接聽程式的 Application Load Balancer 需要 https://domain-name:8080/ 端點 URL 格式。
    **重要:**使用您選擇的連接埠和接聽程式規則,為 Application Load Balancer 建立HTTP 接聽程式HTTPS 接聽程式。如需詳細資訊,請參閱 Application Load Balancer 的接聽程式。對於設定了 HTTPS 接聽程式的 Application Load Balancer,支援 API Gateway 的憑證授權機構必須核發關聯的憑證。如果您必須使用自我簽署或由私人憑證授權機構核發的憑證,請在整合的 tlsConfig 中將 insecureSkipVerification 設定為 true
  7. 選擇儲存
  8. 部署 API

將 API Gateway REST API 與私有 Application Load Balancer 整合

請完成下列步驟:

  1. 使用 API Gateway VPC 連結整合,將 API 與私有 Network Load Balancer 整合
  2. 使用 Network Load Balancer 將 API 請求轉送至私有 Application Load Balancer