· 6 years ago · Feb 08, 2019, 09:16 PM
1sc.hadoopConfiguration.set("fs.s3n.awsAccessKeyId", "<your access key>")
2sc.hadoopConfiguration.set("fs.s3n.awsSecretAccessKey","<your secretkey>")
3
4$ export AWS_SECRET_ACCESS_KEY=
5$ export AWS_ACCESS_KEY_ID=
6
7ERROR ApplicationMaster: User class threw exception: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception:
8Access Denied
9
10{
11 "Id": "Policy1",
12 "Version": "2012-10-17",
13 "Statement": [
14 {
15 "Sid": "Stmt1",
16 "Action": "s3:*",
17 "Effect": "Allow",
18 "Resource": [
19 "arn:aws:s3:::other-account-bucket",
20 "arn:aws:s3:::other-account-bucket/*"
21 ],
22 "Principal": {
23 "AWS": [
24 "arn:aws:iam::ACCOUNT-NUMBER:role/EMR_EC2_DefaultRole"
25 ]
26 }
27 }
28 ]
29}