I am having trouble debugging an error I am getting.
botocore.exceptions.ClientError: An error occurred (InvalidParameterCombination) when calling the RunInstances operation: Network interfaces and an instance-level subnet ID may not be specified on the same request
This is the code.
# Make EC2s with AWS Ubuntu 20
instances = subnet.create_instances(ImageId='ami-0885b1f6bd170450c',
InstanceType='m1.small',
MaxCount=num,
MinCount=num,
Monitoring={'Enabled': True},
KeyName=key_name,
IamInstanceProfile={
'Arn': 'arn goes here',
},
NetworkInterfaces=[{
'DeviceIndex': 0,
'SubnetId': subnet.subnet_id,
'AssociatePublicIpAddress': True,
'Groups': [security_group.group_id]
}])
What is baffling me is that I do not specify a top level subnet id. And even when I remove subnet id entirely I get the error.
My guess is that something is being default set but I do not know how to stop that if it is the case.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…