cloudformation 资源部分是否有全局属性?

Ore*_*est 5 amazon-web-services aws-cloudformation

我的 lambda 有一个 cloudformation 模板:

Resources:
  Resource1:
    Type: AWS::Res
    Properties:
      StreamArn: 
         "Fn::Sub": "${var1}-${var2}"
  Resource2:
    Type: AWS::Res
    Properties:
      StreamArn: 
         "Fn::Sub": "${var1}-${var2}"
Run Code Online (Sandbox Code Playgroud)

是否可以将这些属性移动到部分Properties字段Resources或任何其他位置以避免重复?

Resources:
   Properties:
       StreamArn: 
           "Fn::Sub": "${var1}-${var2}"
Run Code Online (Sandbox Code Playgroud)

我尝试过这样做,但没有成功。

Joh*_*ein 4

您可以使用Parameters具有默认值的条目来创建与常量变量等效的项,但它不能接受该Resources部分中的任何值(因为此时尚未创建它们)。

否则,不行——您需要复制这些值。(截至撰写此答案时。)