我正在嘗試使用 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"
uj5u.com熱心網友回復:
格式:
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"
一個例子:
SourceArn:
Fn::Join:
- ''
- - 'arn:'
- !Ref AWS::Partition
- ":execute-api:"
- !Ref AWS::Region
- ":"
- !Ref AWS::AccountId
- ":"
- !Ref ApiGatewayRestApiResource
- "/"
- !Ref ApiGatewayStageResource
- "/GET/example"
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/412504.html
標籤:
上一篇:反應影像src未定義-AWSS3
