gpt4 book ai didi

amazon-web-services - 您可以将 "Fn::FindInMap"嵌套在 "Fn::Sub"中吗?

转载 作者:行者123 更新时间:2023-12-03 07:15:39 24 4
gpt4 key购买 nike

我正在这样做:

{"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" } ] }"}

最佳答案

您无法直接从 Fn::Sub 模板调用 Fn::FindInMapOnly 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

关于amazon-web-services - 您可以将 "Fn::FindInMap"嵌套在 "Fn::Sub"中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58986248/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com