Amazon cloudformation 仅使用CloudFormation分配公共IP

Amazon cloudformation 仅使用CloudFormation分配公共IP,amazon-cloudformation,Amazon Cloudformation,我正在使用CloudFormation创建一个EC2实例。 我试图实现的只是分配一个公共IP。没有私有IP。 一切都很好地创建,它为公共IP创建了一个DNS条目,但也创建了一个私有IP。我如何告诉它不要创建私有IP。 这是我的模板: Resources: EC2Instance: Properties: ImageId: Ref: ImageId InstanceType: Ref: InstanceType Key

我正在使用CloudFormation创建一个EC2实例。 我试图实现的只是分配一个公共IP。没有私有IP。 一切都很好地创建,它为公共IP创建了一个DNS条目,但也创建了一个私有IP。我如何告诉它不要创建私有IP。 这是我的模板:

Resources:
  EC2Instance:
    Properties:
      ImageId:
        Ref: ImageId
      InstanceType:
        Ref: InstanceType
      KeyName:
        Ref: KeyName
      NetworkInterfaces:
      - GroupSet:
        - Ref: GroupId
        DeviceIndex: 0
        DeleteOnTermination: true
        SubnetId:
          Ref: SubnetId
    Type: AWS::EC2::Instance
  DnsRecord:
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneName: !Ref 'HostedZoneName'
      Comment: DNS name for my instance.
      Name: !Join ['', [!Ref 'Subdomain', ., !Ref 'HostedZoneName']]
      Type: A
      TTL: '300'
      ResourceRecords:
      - !GetAtt EC2Instance.PublicIp

你总是有私有IP。你那边有什么问题吗