CloudFormation和GET请求

0

【以下的问题经过翻译处理】 我有一个CloudFormation模板,可以做很多事情,包括部署一个API Gateway GET路由并与Lambda函数集成。结果是:

(80390c37-5d4a-46cb-b7f0-e38684943499)由于配置错误而导致执行失败:
2022-02-09T12:19:34.819+00:00
(80390c37-5d4a-46cb-b7f0-e38684943499)方法状态为:500

随后,在搜索后,我偶然发现了这篇文章,简直不敢相信我所读到的:

https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-lambda-template-invoke-error/

这是正确的吗????? 如何使用CloudFormation集成获取请求?手动操作可以。

1 Answer
0

【以下的回答经过翻译处理】 不了解你的Cloudformation版本的情况下,很难说,无论如何,您链接的文章讨论的是API网关和Lambda之间的集成,而不是从API网关公开的方法。

举个例子,您可以看到有“HttpMethod”和“IntegrationHttpMethod” HttpMethod可以是允许的任何API网关方法,但IntegrationHttpMethod需要是POST

  apiGatewayRootMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      Integration:
        IntegrationHttpMethod: POST
        Type: AWS_PROXY
        Uri: !Sub
          - arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations
          - lambdaArn: !GetAtt lambdaFunction.Arn
      ResourceId: !GetAtt apiGateway.RootResourceId
      RestApiId: !Ref apiGateway

profile picture
EXPERT
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions