amazon-web-services - 如何获取 aws :lambda function as a text? 的 Uri

标签 amazon-web-services aws-lambda aws-api-gateway

我正在尝试将 API 网关链接到预定义的 lambda 函数。然而它说不受支持的属性(property) Uri。我的 lambda 函数在给定区域中创建为“SayHelloFunction”。

  SayHello:
    Type: "AWS::ApiGateway::Method"
    DependsOn:
      - RootApi
      - HelloResource
    Properties:
      RestApiId: !Ref RootApi
      ResourceId: !Ref HelloResource
      HttpMethod: PUT
      MethodResponses:
        - StatusCode: 200
      AuthorizationType: NONE
      ApiKeyRequired: true
      Integration:
        IntegrationHttpMethod: PUT
        IntegrationResponses:
          - StatusCode: 200
        Type: AWS_PROXY
      Uri: 'arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:xxxxxxxxxxxx:function:SayHelloFunctionFunctionArn/invocations'

请帮忙。

最佳答案

您可以通过如下所示的调用来使用 Lambda Arn 属性进行设置。

Uri: !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${SayHelloFunction.Arn}/invocations

您将在这里获得更多详细信息:https://github.com/aviboy2006/lambda-apigateway-sns-cnf-awsugblrdemo/blob/main/sample.yaml

关于amazon-web-services - 如何获取 aws :lambda function as a text? 的 Uri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67837970/

相关文章:

amazon-web-services - 如何通过其友好名称或使用 cloudformation 的 arn 从云上现有的 Lambda 函数获取角色名称?

json - API 网关 : JSON 5+ MB Gives error "413, Request Too Long"

amazon-web-services - 如何在AWS API Gateway映射模板中设置对象键值

java - AWS SDK 2.x 中是否替换了 SelectObjectContentRequest?

amazon-web-services - <AWS S3> 如何将文件归档到以日期为前缀的文件夹中?

amazon-web-services - AWS sam 部署嵌套堆栈 - 来自子堆栈的错误不会冒泡

javascript - 递归调用返回 promise 的异步函数

amazon-web-services - AWS Lambda 函数超时

amazon-web-services - Lambda@Edge 和 AWS EC2 延迟比较

json - 有没有办法将请求的 header 和正文传递到 aws 步骤函数管道?