मैं 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 में अनुरोध में कोई ग्रुप पैरामीटर नहीं है।
क्या मुझे कुछ याद आ रही है?
यह सिर्फ मुझे घंटों बचाता है। – Brett