Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ACL permissions for write_dynamic_frame_from_options in to S3 using AWS Glue

How to add -acl permissions on s3 objects while trying to output Glue DynamicFrame using write_dynamic_frame_from_options. I gave this line of code when i tried converting data and drop the csv files into another AWS account S3 bucket

glueContext.write_dynamic_frame.from_options(frame = DATA_temp, connection_type = "s3", connection_options = {"path": "s3://{BUCKETNAME}/{FOLDER1}/#0001"}, format = "csv")

My process finished successfully but i was unable to download or open files in that account??

like image 659
pyhotshot Avatar asked Jan 25 '23 17:01

pyhotshot


1 Answers

This will do the trick

glueContext._jsc.hadoopConfiguration().set("fs.s3.canned.acl", "BucketOwnerFullControl")

The scala version is as below:

glueContext.sparkContext.hadoopConfiguration.set("fs.s3.canned.acl", "BucketOwnerFullControl")
like image 64
Eman Avatar answered Feb 08 '23 17:02

Eman