Fai*_*ani 5 amazon-web-services aws-cloudformation aws-lambda aws-api-gateway
我正在尝试使用 cloudformation 部署函数和 aws api 网关。在LambdaPermission资源中,有一个属性为SourceArn,它期望将调用该函数的资源的 ARN,在本例中它将是 api 网关。现在ApiGateway资源不提供arn的输出值。所以我的问题是我们如何访问它?
这是 Lambda Permission 的资源,我需要将值放入 sourcearn 中。
LambdaPermission:
Type: "AWS::Lambda::Permission"
Properties:
Action: "lambda:InvokeFunction"
FunctionName: !GetAtt LambdaFunction.Arn
Principal: "apigateway.amazonaws.com"
SourceArn: "How to get this value"
Run Code Online (Sandbox Code Playgroud)
格式:
SourceArn:
Fn::Join:
- ''
- - 'arn:'
- !Ref AWS::Partition
- ":execute-api:"
- !Ref AWS::Region
- ":"
- !Ref AWS::AccountId
- ":"
- !Ref "Logical ID of resource of type AWS::ApiGateway::RestApi"
- "/"
- !Ref "Logical ID of resource of type AWS::ApiGateway::Stage"
- "/GET or POST or other HTTP Methods/your/resource/path/here"
Run Code Online (Sandbox Code Playgroud)
一个例子:
SourceArn:
Fn::Join:
- ''
- - 'arn:'
- !Ref AWS::Partition
- ":execute-api:"
- !Ref AWS::Region
- ":"
- !Ref AWS::AccountId
- ":"
- !Ref ApiGatewayRestApiResource
- "/"
- !Ref ApiGatewayStageResource
- "/GET/example"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2580 次 |
| 最近记录: |