首页 文章

使用CloudFormation为APIGateway提供适当的子域

提问于
浏览
2

我有一个APIGateway工作,有一些lambda函数支持它和其他所有工作 .

现在我需要将APIGateway锁定到我的域名 . 想象一下,我有域www.example.com,我希望所有对foobar.example.com的调用都在我的APIGateway上结束 .

我需要使用CloudFormation创建哪些资源才能获得此资源?

示例模板将受到高度赞赏 .

1 回答

  • 1

    您需要通过CLI或SDK或控制台在API网关上使用 foobar.example.com 创建自定义域,因为此时CloudFormation不支持它 . 然后,您可以在CloudFormation模板中为自定义域创建基本路径映射 .

    {
      "Type" : "AWS::ApiGateway::BasePathMapping",
      "Properties" : {
        "BasePath" : String,
        "DomainName" : String,
        "RestApiId" : String,
        "Stage" : String
      }
    }
    

相关问题