I am doing a cross account copy of s3 objects. When I am trying to copy files from source bucket to destination bucket I am getting the error ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden I am getting error at line s3_object.download_fileobj(buffer)
final_df=pd.DataFrame()
for file in files1:
# file=file.split('/')[-1]
bucket = 'source bucket'
buffer = io.BytesIO()
s3 = boto3.resource('s3')
s3_object = s3.Object(bucket,file)
s3_object.download_fileobj(buffer)
df = pd.read_parquet(buffer)
print(file)
s3 = boto3.client('s3')
file=file.split('/')[-1]
print(file)
final_df=pd.concat([final_df,df],sort=False)
Files1 is the list of all parquet files in the bucket