【问题标题】:Cloudformation error: Value of property NetworkInterfaces must be a list of objectsCloudformation 错误:属性 NetworkInterfaces 的值必须是对象列表
【发布时间】:2017-12-05 00:09:13
【问题描述】:

在 CloudFormation 模板中引用 NetworkInterface 时出现错误 Value of property NetworkInterfaces must be a list of objects

以下是相关部分:

MyAppNetworkInterface: Type: AWS::EC2::NetworkInterface Properties: SubnetId: !Ref SubnetPrivate

我的应用程序: 类型:AWS::EC2::Instance 特性: 实例类型:t2.medium 网络接口: - !Ref MyAppNetworkInterface

【问题讨论】:

    标签: amazon-cloudformation


    【解决方案1】:

    您实际上可以直接从 EC2 主机引用网络接口。但语法略有不同:

    MyAppNetworkInterface:
      Type: AWS::EC2::NetworkInterface
      Properties:
        SubnetId: !Ref SubnetPrivate
    
    MyApp:
      Type: AWS::EC2::Instance
      Properties:
        InstanceType: t2.medium
        NetworkInterfaces:
        - NetworkInterfaceId: !Ref MyAppNetworkInterface
          DeviceIndex: 0
    

    (见:http://docs.amazonaws.cn/en_us/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-templateexamples

    【讨论】:

      【解决方案2】:

      你不能那样做。相反,独立创建这两个资源,然后连接到网络接口附件资源。

      http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html

      【讨论】:

        猜你喜欢
        • 2018-08-01
        • 2020-03-25
        • 1970-01-01
        • 2020-07-14
        • 2021-12-05
        • 2019-04-22
        • 2010-11-23
        • 1970-01-01
        • 2021-11-23
        相关资源
        最近更新 更多