CloudFormation模板中如何同时使用Sub和GetAtt函数? [英] How to use Sub and GetAtt functions at the same time in CloudFormation template?
本文介绍了CloudFormation模板中如何同时使用Sub和GetAtt函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了 CloudFormation yaml 模板,我需要使用 !GetAtt "TestLambda.Arn"
作为 "AWS::ApiGateway:: 中 !Sub
函数的一部分方法"集成URI:
I created CloudFormation yaml template and I need to use !GetAtt "TestLambda.Arn"
as part of !Sub
function in "AWS::ApiGateway::Method" Integration Uri:
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"
结果我想得到一个类似的值:
As result I want to get a value something like that:
"arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/my-endpoint-lambda/invocations"
如何将这些功能结合使用并获得想要的结果?
How can I use these functions together and get the desired result?
推荐答案
如果首先使用 !
短格式,我们可以将 Fn::
用于嵌套的内部函数.所以
We can use Fn::
for the nested intrinsic functions if using the !
short form first. So
!Sub "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/$(Fn::GetAtt:[TestLambda, Arn])/invocations"
这篇关于CloudFormation模板中如何同时使用Sub和GetAtt函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文