不能在同一请求上指定网络接口和实例级私有 IP 地址
我正在尝试使用 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 实例时失败并出现错误:
调用 RunInstances 操作时发生错误 (InvalidParameterCombination):同一请求中可能未指定网络接口和实例级私有 IP 地址
请让我知道缺少什么。我检查了参数,看起来都很好。
I am trying to create an EC2 instance using boto3 client.run_instances(**parameters) method.
This is the value of my parameters:
{
"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
}
However the stack is failing on creation of an ec2 isntance with an error :
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
Could let me know what is missing. I have checked the parameters they all looks to be fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您可以在
NetworkInterfaces
块内请求私有 IP 地址:It looks like you can request a Private IP address within the
NetworkInterfaces
block: