我正在尝试将 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/