AWS RDS Boto3 question

#!/usr/bin/env python3
import boto3
import pandas as pd
client = boto3.client(‘rds’)
response = client.describe_db_instances()
for i in range(len(response[‘DBInstances’])):
name = response[‘DBInstances’][i][‘DBInstanceIdentifier’]
out = client.describe_db_log_files(DBInstanceIdentifier=name)
for x in range(len(out[‘DescribeDBLogFiles’])):
file = out[‘DescribeDBLogFiles’][‘LogFileName’]
if (open(str(file), ‘r’).read().find(‘could not receive data from client: Connection reset by peer’)):
print(name)

​

Error :

Traceback (most recent call last):
File “/Users/akushwaha/Devops/aws-boto/aws-rds.py”, line 13, in
if (open(str(file), ‘r’).read().find(‘could not receive data from client: Connection reset by peer’)):
FileNotFoundError: [Errno 2] No such file or directory: ‘error/postgresql.log.2022’

how can I fix this problem ?


Related discussions:

your code is parsing for the names of the error files i.e

error/postgresql.log.2022

and then you are trying to open it as though that file is on your local machine.

you need to download the log files if you want to interact with them locally.