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

posta 4 anni fa1197 visualizzazioni
1 Risposta
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.

con risposta 4 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande