我正在这样做:
{"Fn::Join": [":", [
"arn:aws:sns",
{ "Ref": "AWS::Region"},
{ "Ref": "AWS::AccountId"},
{"Fn::FindInMap" : [ "config", "mytopic", { "Ref" : "deployment" } ] }
]]
但是我更喜欢像这样使用SUB,但是它不是有效的json:
{"Fn::Sub" : "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:${"Fn::FindInMap" : [ "config", "mytopic", { "Ref" : "deployment" } ] }"}
答案 0 :(得分:0)
您不能直接从Fn::FindInMap
模板调用Fn::Sub
。 Only a limited number of expressions work OOTB.
相反,您可以将其他变量传递给Fn::Sub
。例如:
DefinitionString: !Sub
- |-
{
"Comment":"Extract metadata and anonymize the videoclip",
"StartAt":"ExtractMetadataAndAnonymize",
"States":{
"ExtractMetadataAndAnonymize":{
"Type":"Parallel",
"Next":"LogResult",
"Branches":[
{
"StartAt":"AlarmIfVideoverarbeitungClusterIsEmpty",
"States":{
"AlarmIfVideoverarbeitungClusterIsEmpty":{
"Type":"Task",
"Resource":"${EmptyVideoverarbeitungClusterAlarmFunction_Arn}",
....
}
}
}
- EmptyVideoverarbeitungClusterAlarmFunction_Arn: !ImportValue
'Fn::Sub': 'stk-${EnvType}-${EnvId}-videoverarbeitung-cluster-EmptyVideoverarbeitungClusterAlarmFunction-Arn'
在这里,我计算一些值并将其作为EmptyVideoverarbeitungClusterAlarmFunction_Arn
变量传递给Sub
。