在AWS :: Lambda :: Function中为环境变量设置Fn :: ImportValue

时间:2019-12-12 22:57:36

标签: amazon-web-services aws-lambda amazon-cloudformation

如何在AWS :: Lambda :: Function中为环境变量设置Fn :: ImportValue, 我尝试过:

  Environment:
    Variables:
      VAL1: Fn::ImportValue: "SOME_OUTPUT"

但是我收到“模板格式错误:YAML格式不正确”

2 个答案:

答案 0 :(得分:1)

使用:

Environment:
  Variables:
    VAL1:
      Fn::ImportValue: NAME-OF-EXPORTED-VALUE

请参阅:Fn::ImportValue - AWS CloudFormation

答案 1 :(得分:0)

应该是这样的:

Environment:
  Variables:
    VAL1: {Fn::ImportValue: "SOME_OUTPUT"}