禁用 REST API 的默认终端节点
默认情况下,客户端可以通过使用 API Gateway 为 API 生成的 execute-api
终端节点来调用您的 API。为确保客户端只能通过使用自定义域名访问您的 API,请禁用默认 execute-api
终端节点。
禁用默认终端节点时,它会影响 API 的所有阶段。
以下 Amazon CLI 命令会禁用 REST API 的默认终端节点。
aws apigateway update-rest-api \ --rest-api-id
abcdef123
\ --patch-operations op=replace,path=/disableExecuteApiEndpoint,value='True'
禁用默认终端节点后,必须部署 API 才能使更改生效。
以下 Amazon CLI 命令会创建部署。
aws apigateway create-deployment \ --rest-api-id
abcdef123
\ --stage-namedev