0

I'm trying to use a s3proxy with Hadoop 3.1.2 but I'm getting a 403 error whereas with hadoop 2.7 it seems to work. Is that a regression or a misconfig on my side ?

s3proxy config

s3proxy.endpoint=http://127.0.0.1:4242
s3proxy.authorization=aws-v2
s3proxy.identity=local-identity
s3proxy.credential=local-credential
jclouds.provider=filesystem
jclouds.filesystem.basedir=/tmp/s3proxy

Simple scala code

sc.hadoopConfiguration.set("fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem")
sc.hadoopConfiguration.set("fs.s3a.aws.credentials.provider", "org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider")
sc.hadoopConfiguration.set("fs.s3a.endpoint", "127.0.0.1:4242")
sc.hadoopConfiguration.set("fs.s3a.connection.ssl.enabled", "false")
sc.hadoopConfiguration.set("fs.s3a.access.key", "local-identity")
sc.hadoopConfiguration.set("fs.s3a.secret.key", "local-credential")
val rdd = sc.textFile("s3a://wiki/test.json")
rdd.collect().foreach(println)

with tree /tmp/s3proxy

/tmp/s3proxy/
└── wiki
    └── test.json

With hadoop2.7, I'm getting the correct output.

cat demo_wiki/test01.scala | ./spark-2.4.4-bin-hadoop2.7/bin/spark-shell --jars hadoop-aws-2.7.3.jar,aws-java-sdk-1.7.4.jar

but with hadoop3.1.2, I'm getting a 403 error.

cat demo_wiki/test01.scala | ./spark-2.4.4-bin-hadoop3.1/bin/spark-shell --jars hadoop-aws-3.1.2.jar,aws-java-sdk-bundle-1.11.271.jar

Output:

2019-09-23 15:23:32 WARN  MetricsConfig:134 - Cannot locate configuration: tried hadoop-metrics2-s3a-file-system.properties,hadoop-metrics2.properties
java.nio.file.AccessDeniedException: s3a://wiki/test.json: getFileStatus on s3a://wiki/test.json: com.amazonaws.services.s3.model.AmazonS3Exception: Forbidden (Service: Amazon S3; Status Code: 403; Error Code: 403 Forbidden; Request ID: 4442587FB7D0A2F9; S3 Extended Request ID: null), S3 Extended Request ID: null:403 Forbidden

Any idea ?

Andrew Gaul
  • 2,296
  • 1
  • 12
  • 19
ticapix
  • 1,534
  • 1
  • 11
  • 15

1 Answers1

0

Found the answer looking at the Dockerfile (https://github.com/gaul/s3proxy/blob/master/Dockerfile#L24)

The correct s3proxy config is

s3proxy.endpoint=http://127.0.0.1:4242
s3proxy.authorization=aws-v2-or-v4
s3proxy.identity=local-identity
s3proxy.credential=local-credential
jclouds.provider=filesystem
jclouds.filesystem.basedir=/tmp/s3proxy

And the command line with latest (at that time) version of spark-2.4.4 + hadoop-3.2.0 + aws-sdk-1.11.636 is working fine

cat test.scala | ./spark-2.4.4-bin-hadoop3.2/bin/spark-shell --jars hadoop-aws-3.2.0.jar,aws-java-sdk-bundle-1.11.636.jar
ticapix
  • 1,534
  • 1
  • 11
  • 15