我们有多个子网和专有网络。在请求点实例期间,如何定义特定子网和专有网络?
以下是我的代码:
client = boto3.client('ec2')
response = client.request_spot_instances(
DryRun=False,
ClientToken=''.join(random.choices(string.ascii_lowercase + string.digits, k=10)),
InstanceCount=1,
Type='one-time',
LaunchSpecification={
'ImageId': 'ami-db710fa3',
'KeyName': 'my_key',
'InstanceType': 'm4.4xlarge',
'Placement': {
'AvailabilityZone': 'us-east-2a',
},
'BlockDeviceMappings': [
{
'Ebs': {
# 'SnapshotId': 'snap-f70deff0',
'VolumeSize': 100,
'DeleteOnTermination': True,
'VolumeType': 'gp2',
'Iops': 300,
'Encrypted': False
},
},
],
'EbsOptimized': True,
'Monitoring': {
'Enabled': True
},
'SecurityGroupIds': ['sg-1231231' ],
'NetworkInterfaces': [
{
'DeviceIndex': 123,
'SubnetId': 'Subnet-df123123'
},
],
}
)
但是,上面的代码正在抛出错误,
botocore.exceptions.clientError:发生错误
(InvalidParameterCombination)调用RequestSpotinstances时
操作:网络接口和实例级安全组
不能在同一请求上指定
谢谢你的帮助