0

您好我正在尝试将数据帧作为 csv 文件保存到 S3 存储桶中,但访问被拒绝。我不确定我错过了什么。你能帮我解决我的问题吗?

我正在使用下面的代码 -

import boto3
from io import StringIO

bucket = '**********' # already created on S3
        
csv_buffer_mbox = StringIO()
df.to_csv(csv_buffer_mbox, index=False, sep=',')
csv_buffer_mbox.seek(0)
s3_resource_mbox = boto3.resource('s3')
print(s3_resource_mbox)
s3_resource_mbox.Object(bucket, 'Extract/iConnect/Suggestion/'+file_name).put(Body=csv_buffer_mbox.getvalue())

低于错误 -

An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
4

0 回答 0