Yaml 此区域不支持端点配置类型EDGE

Yaml 此区域不支持端点配置类型EDGE,yaml,amazon-cloudformation,aws-api-gateway,Yaml,Amazon Cloudformation,Aws Api Gateway,我正试图通过CloudFormation(YAML+Swagger)启动一个AWSAPI网关 当我试图通过控制台启动堆栈时,我不断得到 “此区域不支持端点配置类型EDGE:us-gov-west-1” 我已经将端点配置指定为“REGIONAL”,但似乎不需要 这个API网关已经通过控制台成功创建,所以我假设它应该使用CloudFormation工作 在这一点上,我猜测,默认情况下,它与边缘,这甚至可能不支持在政府地区 AWSTemplateFormatVersion: '2010-09-09'

我正试图通过CloudFormation(YAML+Swagger)启动一个AWSAPI网关

当我试图通过控制台启动堆栈时,我不断得到

“此区域不支持端点配置类型EDGE:us-gov-west-1”

我已经将端点配置指定为“REGIONAL”,但似乎不需要

这个API网关已经通过控制台成功创建,所以我假设它应该使用CloudFormation工作

在这一点上,我猜测,默认情况下,它与边缘,这甚至可能不支持在政府地区

AWSTemplateFormatVersion: '2010-09-09'
Resources:
  rTestAPI:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: Test API
      Description: A test API
      EndpointConfiguration:
        Types:
          - REGIONAL
      Body:
        swagger: '2.0'
        info:
          version: '2019-01-11T16:05:08Z'
          title: test-api
        # host: 9lazpn2fob.execute-api.us-gov-west-1.amazonaws.com
        basePath: /default
        schemes:
          - https
        paths:
          /test:
            post:
              consumes:
                - application/json
                - application/x-www-form-urlencoded
              produces:
                - application/json
                - text/html
              responses:
                '200':
                  description: 200 response
                  schema:
                    $ref: '#/definitions/Empty'
                  headers:
                    Access-Control-Allow-Origin:
                      type: string
                    Access-Control-Allow-Headers:
                      type: string
                    Content-Type:
                      type: string
                '400':
                  description: 400 response
                  schema:
                    $ref: '#/definitions/Error'
                  headers:
                    Access-Control-Allow-Origin:
                      type: string
                    Access-Control-Allow-Headers:
                      type: string
                    Content-Type:
                      type: string
            options:
              consumes:
                - application/json
              produces:
                - application/json
              responses:
                '200':
                  description: 200 response
                  schema:
                    $ref: '#/definitions/surveydata'
                  headers:
                    Access-Control-Allow-Origin:
                      type: string
                    Access-Control-Allow-Methods:
                      type: string
                    Access-Control-Allow-Headers:
                      type: string
        definitions:
          Empty:
            type: object
            title: Empty Schema
          Error:
            type: object
            properties:
              message:
                type: string
            title: Error Schema
          surveydata:
            type: object
            properties:
              name:
                type: string
            title: Survey Data Schema

我的预期结果是CloudFormation创建了一个带有区域端点的API网关。

我在中国也遇到了同样的问题,对于我更新的一个堆栈,它包含了一个招摇过市的主体,而对于我创建的另一个堆栈,它不起作用

因此,我能够使用的唯一解决方法是在没有Swigger主体的情况下部署堆栈和API网关,然后包括Swigger主体并更新堆栈。我所做的是创建这个空堆栈:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "The AWS CloudFormation template for this Serverless application",
    "Resources": {
        "ApiGatewayRestApi": {
            "Type": "AWS::ApiGateway::RestApi",
            "Properties": {
                "Name": "my-api-name",
                "EndpointConfiguration": {
                    "Types": [ "REGIONAL" ]
                }
            }
        }
    }
}
已成功创建。请注意,您必须使用相同的逻辑id来更新它(在我的例子中,它是“ApiGatewayRestApi”)。在那之后,我大摇大摆地使用了实际的模板并对其进行了更新


希望这有帮助

当使用
Swagger
导入
主体
时,CFN忽略
端点配置
字段。要解决此问题,请尝试将
endpointConfigurationTypes
添加到
参数中,如下例所示:

 ApiGatewayApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Parameters:
        endpointConfigurationTypes: REGIONAL
        ignore: documentation
      BodyS3Location:
        Bucket: BATS::SAM::CodeS3Bucket
        Key:xxxxxx
      EndpointConfiguration:
        Types:
        - REGIONAL

工作起来像一个charmIt,对我来说很有用。我只是将它们添加到我的xml文件中,用于创建堆栈。