【问题标题】:Adding VPC Peering in CloudFormation across different regions在 CloudFormation 中跨不同区域添加 VPC 对等互连
【发布时间】:2019-08-22 20:42:19
【问题描述】:

我正在不同区域的 2 个 VPC 之间创建一个 VPC 对等互连。对于对等连接设置的 VpcId,我正在尝试从之前创建 VPC 的另一个堆栈导入 VPC ID。这是我的代码:

VpcPeeringConnection:
    Type: "AWS::EC2::VPCPeeringConnection"
    Properties:
      VpcId:
        - Fn::ImportValue: !Sub ${VpcStack}-vpcId
      PeerVpcId: !Ref PeerVPCId
      PeerRegion: !Ref PeerRegion

我收到以下错误

Template error: the attribute in Fn::ImportValue must not depend on any resources, imported values, or Fn::GetAZs

【问题讨论】:

  • 您是否将 VPC id 导出为其他堆栈的输出?更多详情here

标签: amazon-cloudformation amazon-vpc


【解决方案1】:

不能使用Fn::ImportValue 从另一个区域的堆栈中检索值。

您不能跨区域创建跨堆栈引用。您可以使用内部函数 Fn::ImportValue 仅导入已在同一区域内导出的值。 source

【讨论】:

    猜你喜欢
    • 2018-08-02
    • 2016-05-26
    • 2021-11-06
    • 2019-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-14
    • 2017-06-08
    相关资源
    最近更新 更多