ec2.describe_instances returns an empty Reservations list

0

I have an ec2 instance running.
If I use the aws cli command "aws ec2 describe-instances" I get this instance.
However when I try boto3 code:

import boto3
    
ec2 = boto3.client('ec2')
response = ec2.describe_instances()
print(response)

I get an empty Reservations list.

Any idea?

Edited by: amirdolev on Apr 20, 2020 1:34 AM

asked 4 years ago1185 views
1 Answer
0

Problem was that I had a default region defined in the ~/.aws/config file. Since my running instance was in a different region, it was not identified.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions