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

질문됨 4년 전1197회 조회
1개 답변
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.

답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠