メインコンテンツまでスキップ

Custom Domain の追加

Custom Domain を使うと、クライアントはデフォルトドメインの代わりに、api.yourcompany.com などの独自ドメインで API を呼び出せます。API Gateway は、選択した Certificate を使って Custom Domain を HTTPS で提供します。

警告
  • ドメインを所有し、その DNS レコードを編集できる必要があります。
  • 組織に、追加するドメインを Domains (SAN) に含む Certificate が必要です(例: *.yourcompany.com は api.yourcompany.com を含みます)。まだない場合は、先に Certificate をインポートするか、ステップ 2 で直接インポートします。
ステップ 1Gateway Endpoint タブを開き、Add Domain をクリックします
1 / 5
ステップ 1: Gateway Endpoint タブを開き、Add Domain をクリックします

画像をクリックすると拡大します。

Custom Domain を追加する​

Custom Domain を追加するには、次の手順を実行します。

  1. 左側のメニューで API Gateway → Gateway を選択し、API Gateway の名前をクリックします。Gateway Endpoint タブを選択してから、Add Domain をクリックします。

Create Custom Domain フォーム

  1. Create Custom Domain フォームで次の情報を入力します。
フィールド必須説明
Domain nameY完全なドメイン名です(例: api.yourcompany.com)。https://、path、ワイルドカードは含めません。組織内の他の Custom Domain と重複できません。
DescriptionNドメインの用途です。
CertificateYドメインを含む Certificate です。一覧の各 Certificate には Domains (SAN) と有効期限が表示されます。新しい Certificate をインポートするには、一覧の下部にある + Import certificate をクリックします。

各 Certificate の Domains (SAN) と有効期限が表示された Certificate 一覧

Certificate が有効でドメインを含む場合、フォームに This certificate covers <domain>. と表示されます。その下の青いボックスには、API Gateway の Load Balancer IP がコピーアイコン付きで表示されます。

入力済みの Create Custom Domain フォーム

  1. Add domain をクリックします。このボタンは、ドメインと Certificate が有効な場合にのみ有効になります。

Create Custom Domain successfully というメッセージが表示されます。新しい Custom Domain が Gateway Endpoint タブの先頭に Cert valid の状態で表示されます。ドメインは API Gateway 一覧の Gateway URL 列と、Certificate の SNIs 列と Used by 列にも表示されます。

Cert valid の状態の新しい Custom Domain

  1. DNS プロバイダーで、ドメインをフォームに表示された Load Balancer IP に向ける DNS レコードを作成します。この IP は、API Gateway の Service Configuration → Load Balancer Configuration → Load Balancer IP でも確認できます。
注記

システムは DNS を確認しません。ドメインがトラフィックを処理できるのは、DNS レコードが Load Balancer IP を指し、DNS の変更の反映が完了した後です。

ヒント

API Gateway を作成するときに、Endpoint ステップで Custom Domain を追加することもできます。API Gateway の作成を参照してください。

よくある問題​

エラー原因対処方法
Domain name must be a valid domain, e.g. api.example.com.ドメインに https://、path、無効な文字が含まれているか、階層が 1 つしかありません完全なドメイン名を入力します(例: api.yourcompany.com)。
Wildcard domains are not supported. Enter a fully qualified domain name, e.g. api.example.com.ドメインに * が含まれています特定のドメインを 1 つ入力します。ワイルドカードは Certificate の Domains (SAN) でのみ使用します。
A custom domain must be unique within the organizationこのドメインはすでに組織内の別の API Gateway の Custom Domain です別のドメインを使うか、先にもう一方の API Gateway からドメインを削除します。
<domain> is not in the domains (SAN) of this certificate, so clients would get a certificate name mismatch. Select a certificate that covers this domain.Certificate がドメインを含んでいませんDomains (SAN) にドメインまたは一致するワイルドカードを含む Certificate を選択します。
This certificate is expired. Select another certificate or renew it first. / This certificate is not yet valid …Certificate の有効期限が切れているか、まだ有効になっていません別の Certificate を選択するか、この Certificate を更新します。

Custom Domain を確認する​

  1. Postman または curl で、Custom Domain 経由で Route にリクエストを送信します: https://<Custom Domain>/<Route の path>。レスポンスは、デフォルトドメインを呼び出したときと同じである必要があります。

Custom Domain への POST リクエストが 200 OK を返す

よくある問題​

エラー原因対処方法
状態が Cert valid なのにドメインへのリクエストが失敗するDNS レコードがない、誤った IP を指している、または DNS の変更がまだ反映されていませんDNS レコードを Load Balancer IP と照合し、DNS の更新を待ちます。

次のステップ​

に最終更新