AWS ApiGateway API 密钥源 YAML

问题描述

我无法在 API Gateway 中找到此特定值的正确配置:

enter image description here

我使用 AWS SAM 进行部署。这是我在 YAML 中的堆栈的一部分,主要是 API 网关定义:

Resources:
  OrdersApi:
    Type: AWS::Serverless::Api
    Properties:
      Name: Orders API
      StageName: !Ref Environment
      BinaryMediaTypes:
      - 'application/pdf'
      MethodSettings:
      - LoggingLevel: ERROR
        ResourcePath: '/*'
        HttpMethod: '*'
        DataTraceEnabled: true
        MetricsEnabled: true
      Cors:
        AllowMethods: "'GET,OPTIONS,POST'"
        AllowHeaders: "'*'"
        AllowOrigin: "'*'"
      Auth:
        Authorizers:
          LambdaRequestAuthorizer:
            FunctionPayloadType: REQUEST
            FunctionArn: !GetAtt Auth.Arn
            Identity:
              Headers:
                - access_token

...

如何在我的 SAM/Cloudformation 模板中设置 Api Key Source 类型?文档提到了 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-apikeysourcetype,但这需要我完全更改我的资源类型以符合 Open API 规范,而我只想在部署我的 API 时将该值设置为 AUTHORIZER。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)