将 CNAME 记录指向 API 网关端点主机?

Point CNAME record to API Gateway Endpoint host?

我部署了一个 API 网关区域端点,形式为:

https://some-id.execute-api.us-east-1.amazonaws.com/prod/my-path/

我知道,为了让像 www.my-domain.com 这样的自定义域解析为 https://some-id.execute-api.us-east-1.amazonaws.com/prod/my-path/,我必须设置一个 api 网关自定义域和云端分发。

但是,我只对 www.my-domain.com 解析为 some-id.execute-api.us-east-1.amazonaws.com(没有路径)感兴趣。这样一来,如果部署 ID 发生变化,我就不需要更新我的客户端。

我尝试为 api.my-domain.com 设置值为 some-id.execute-api.us-east-1.amazonaws.com 的 Route53 CNAME 记录,但它不起作用。

我相信您只需要在没有基本映射的情况下离开您的自定义域。来自 AWS documentation:

If you do not set any base mapping under a custom domain name, the resulting API's base URL is the same as the custom domain (e.g., https://api.example.com.) In this case, the custom domain name cannot support more than one API.