Это мой код:
image_id='ami-0bbc25e23a7640b9b'
instance_type='t2.micro'
keypair_name='my_key'
security_group_id='my_security_group_id'
ec2 = boto3.resource('ec2')
response = ec2.create_instances(ImageId=image_id,InstanceType=instance_type,KeyName=keypair_name,MinCount=1,MaxCount=1,SecurityGroups=[security_group_id])
В выводе я вижу
Traceback (most recent call last):
File "2.py", line 98, in <module>
response = ec2.create_instances(ImageId=image_id,InstanceType=instance_type,KeyName=keypair_name,MinCount=1,MaxCount=1,SecurityGroups=[security_group_id])
File "/usr/local/lib/python3.6/site-packages/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the RunInstances operation: Value () for parameter groupId is invalid. The value cannot be empty
Где у меня ошибка?
Я пытался использовать boto3.client
с ec2.run_instances
, но результат тот же. Можете ли вы помочь мне, пожалуйста?