在pyspark(2.2.0)中将CSV文件写入AWS时,如何分配访问控制列表(ACL)? [英] How to assign the access control list (ACL) when writing a CSV file to AWS in pyspark (2.2.0)?

查看:111
本文介绍了在pyspark(2.2.0)中将CSV文件写入AWS时,如何分配访问控制列表(ACL)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以通过

df.repartition(1).write.csv('s3://my-bucket-name/df_name')

我的问题是使用pyspark将文件写入S3时,是否有一种简单的方法将此文件的访问控制列表(ACL)设置为'bucket-owner-full-control'? / p>

My question is that is there an easy way to set the Access Control List (ACL) of this file to 'bucket-owner-full-control' when writing it to S3 using pyspark?

推荐答案

遇到完全相同的问题。 Spark作业将文件写入到服务器端加密设置为拒绝访问的存储桶中。阅读一些博客后,我了解到可以通过将 fs.s3a.acl.default 参数设置为 BucketOwnerFullControl 。
这是代码:

Ran into the exact same issue. Spark job wrote files to a bucket that had server side encryption set to Access Denied. After reading some blogs, I learned that this can be solved by setting the fs.s3a.acl.default parameter to BucketOwnerFullControl. Here is the code:

val spark =SparkSession.builder.appName().getOrCreate()

spark.sparkContext.hadoopConfiguration.set("fs.s3a.acl.default", "BucketOwnerFullControl")

这篇关于在pyspark(2.2.0)中将CSV文件写入AWS时,如何分配访问控制列表(ACL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆