I run an export from an app that we have and it dumps CSV files into S3 by month. The same process drops all the files at once and nothing is different about the file drops. My IAM user has full S3 access. I get
FileNotFoundError: /mybucket/funnel-ad/raw/data/funnel_data_2020_04
and Access Denied during the handling of above exception. The file absolutely does exist, and I've checked manually in s3, plus I am generating the list of files by pulling from s3. Here's my code
session = Session(aws_access_key_id=AK,
aws_secret_access_key=SAK)
s3 = session.resource('s3')
bucket = s3.Bucket('mybucket')
for file in bucket.objects.filter(Prefix='funnel-ad/raw/data'):
if 'funnel_data' in file.key:
readpath = 's3://mybucket/'+str(file.key)
df = pd.read_csv(readpath,engine='python', error_bad_lines=False)
df = df.reindex(sorted(df.columns), axis=1)
dct = df.to_dict(orient = 'records')