我创建了CloudFormation yaml模板,并且需要在“AWS::ApiGateway::Method”集成Uri中使用!GetAtt "TestLambda.Arn"
作为!Sub
函数的一部分:
...
Type: "AWS::ApiGateway::Method"
Properties:
RestApiId:
Ref: "RestApi"
ResourceId:
Ref: "TestResource"
HttpMethod: "GET"
AuthorizationType: "NONE"
Integration:
Type: "AWS_PROXY"
IntegrationHttpMethod: "POST"
Uri: !Sub "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/[[place where I want to use !GetAtt "TestLambda.Arn"]]/invocations"
...
结果,我想得到一个像这样的值:
"arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/my-endpoint-lambda/invocations"
如何一起使用这些功能并获得期望的结果?
最佳答案
您无需在此处使用!GetAtt
,如果将它们放在占位符中,!Sub
将自动为您解压缩值:
Uri: !Sub arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/${TestLambda.Arn}/invocations
这在docs中进行了解释: