I am trying to read a file from s3 bucket with is in another AWS Account.
Steps:
- Generated access id, access key secret and token using
aws sts assume-role
command Set following variables:
export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= export AWS_SESSION_TOKEN=
aws s3 ls s3://...
reading file in spark-shell
sc.hadoopConfiguration.set("fs.s3n.awsAccessKeyId", "XXX") sc.hadoopConfiguration.set("fs.s3n.awsSecretAccessKey", "XXX") sc.hadoopConfiguration.set("fs.s3a.session.token", "XXX") spark.read.parquet("file location")
Up to step 3 its working fine.
I am unable to read the file in spark-shell. I am using spark version: 2.4.3. Please let me know what i am missing. Any help would be appreciated.
Error log:
Caused by: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: The AWS Access Key Id you provided does not exist in our records.