yadavankit
yadavankit

Reputation: 353

AWS boto3 : ClientError when calling run_instances with AMI ID

ec2_resource = boto3.resource('ec2')
ec2_resource.create_instances(ImageId=MEGATRON_SCRAPER_AMI_ID, MinCount=1, MaxCount=2)

This throws a ClientError as below -

ClientError: An error occurred (Unsupported) when calling the 
RunInstances operation: The requested configuration is currently not 
supported. Please check the documentation for supported configurations.

Concerned AWS Region is Mumbai

Upvotes: 0

Views: 1069

Answers (1)

yadavankit
yadavankit

Reputation: 353

So the EC2 Boto3 Documentation is not either updated or has some other caveat attached.

Well, the documentation here is pretty comprehensive and it turns out that I was actually missing an InstanceType argument while calling create_instances

So the ideal way would be:

ec2_resource = boto3.resource('ec2')
ec2_resource.create_instances(ImageId=MEGATRON_SCRAPER_AMI_ID, MinCount=1, MaxCount=1, InstanceType='t2.micro')

Also, before doing this, see if the credentials and config files in ~/.aws/ have proper values of secret keys, default region etc.

Upvotes: 2

Related Questions