【问题标题】:AWS API Gateway with constant response deployed by SAMSAM 部署的具有持续响应的 AWS API Gateway
【发布时间】:2021-02-26 06:12:14
【问题描述】:

我有一个由 sam cli 开发的 API 网关。

我想添加“hello 端点”,它响应常量元数据,如版本/可用端点。

在这种情况下,有没有办法在 template.yml 中配置 API 网关? 或者我应该写一个像这样返回恒定响应的 lambda?

  helloLambda:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: .....
      Handler: .....
      Description: this lambda returns constant data
      Events:
        Api:
          Type: Api
          Properties:
            Path: /hello
            Method: GET

【问题讨论】:

标签: amazon-web-services aws-api-gateway aws-sam


【解决方案1】:

您可以考虑在 API Gateway 中进行模拟集成。 请参考链接: creating-an-amazon-api-gateway-with-a-mock-integration-using-cloudformation

美好的一天!

【讨论】:

  • AWS::Serverless::Api 是特定于 SAM 的资源,它似乎隐式地创建了一个阶段和一个部署。我不知道如何调整这个。
猜你喜欢
  • 2015-10-05
  • 2018-10-16
  • 2020-12-16
  • 1970-01-01
  • 2021-11-15
  • 2018-06-09
  • 1970-01-01
  • 2018-11-22
  • 2015-12-04
相关资源
最近更新 更多