不能在同一个请求中指定网络接口和实例级私有 IP 地址

Network interfaces and an instance-level private IP address may not be specified on the same request

我正在尝试使用 boto3 client.run_instances(**parameters) 方法创建一个 EC2 实例。 这是我的参数值:

    {
   "ImageId":"ami-XXXXXXXXX",
   "InstanceType":"m4.large",
   "KeyName":"my_key",
   "UserData":"Content-Type: multipart/mixed",
   "Monitoring":{
      "Enabled":false
   },
   "MaxCount":1,
   "MinCount":1,
   "IamInstanceProfile":{
      "Name":"proxyIp-YYYYYYYY"
   },
   "NetworkInterfaces":[
      {
         "DeviceIndex":0,
         "AssociatePublicIpAddress":true,
         "Groups":[
            "sg-09999999fe111"
         ],
         "SubnetId":"subnet-06XXXXXXXXX"
      }
   ],
   "PrivateIpAddress":"AA.BB.C.DDD",
   "EbsOptimized":true
}

但是,堆栈在创建 ec2 实例时失败并出现错误:

An error occurred (InvalidParameterCombination) when calling the RunInstances operation: Network interfaces and an instance-level private IP address may not be specified on the same request

可以让我知道缺少什么。我检查了参数,它们看起来都很好。

您似乎可以在 NetworkInterfaces 块 内请求私有 IP 地址

            "NetworkInterfaces": [
                {
                    "PrivateDnsName": "ip-10-0-0-157.us-east-2.compute.internal",
                    "PrivateIpAddress": "10.0.0.157",
                    "SourceDestCheck": true,
                    "Status": "in-use",
                    "SubnetId": "subnet-04a636d18e83cfacb",
                    "VpcId": "vpc-1234567890abcdef0",
                }
            ],