【发布时间】:2021-04-20 13:37:06
【问题描述】:
我在 api gateway 营销页面上找到了以下 sn-p。
所以我正在为在计算引擎上运行的应用设置 API 网关。由于找不到任何关于如何在 API 引擎上配置计算引擎的文档,我使用内部 DNS 创建了以下配置。enter link description here
swagger: "2.0"
info:
title: API Endpoints
description: API Endpoints
version: 1.0.1
schemes:
- https
produces:
- application/json
paths:
/indexes:
get:
summary: Return Search Indexes
operationId: searchIndexes
x-google-backend:
address: http://my_internal_dns_for_compute_engine.c.myproject.internal/indexes
path_translation: APPEND_PATH_TO_ADDRESS
responses:
"200":
description: A successful response
schema:
type: string
"403":
description: Failed to authenticate
当我使用gcloud 部署配置时,出现以下错误
等待为 API 创建 API 配置 [my-api-config-v6] [my-api]...失败。
错误:(gcloud.beta.api-gateway.api-configs.create)等待服务 配置创建:后端 URL “http://my_internal_dns_for_compute_engine.c.myproject.internal/indexes”是 禁止:无法将请求路由到内部地址。
所以看起来不支持内部 DNS(显然)。
我的计算引擎实例只能通过 VPC 网络访问。如何将我的 api 网关连接到 VPC 网络以及如何通过它访问我的计算引擎?
【问题讨论】:
标签: google-cloud-platform google-compute-engine google-vpc google-api-gateway