10
我试图用boto3创建一个实例实例。虽然我遵循API documentation,但我收到了一个我无法弄清楚的例外情况。我正在使用的代码是:boto3:竞价实例创建
import boto3
import datetime
client = boto3.client('ec2')
response = client.request_spot_instances(
DryRun=False,
SpotPrice='0.10',
ClientToken='string',
InstanceCount=1,
Type='one-time',
LaunchSpecification={
'ImageId': 'ami-fce3c696',
'KeyName': 'awskey.pem',
'SecurityGroups': ['sg-709f8709'],
'InstanceType': 'm4.large',
'Placement': {
'AvailabilityZone': 'us-east-1a',
},
'BlockDeviceMappings': [
{
'Ebs': {
'SnapshotId': 'snap-f70deff0',
'VolumeSize': 100,
'DeleteOnTermination': True,
'VolumeType': 'gp2',
'Iops': 300,
'Encrypted': False
},
},
],
'EbsOptimized': True,
'Monitoring': {
'Enabled': True
},
'SecurityGroupIds': [
'sg-709f8709',
]
}
)
我收到以下异常:
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the RequestSpotInstances operation: Value() for parameter groupId is invalid. The value cannot be empty
的事情是有在API documentation请求没有的groupId参数。
我错过了什么吗?
这只是节省了我的时间。 – Brett