cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Spark streaming is not able to assume role

Vaibhav1000
New Contributor II

Hello,

I am trying to assume an IAM role in spark streaming with "s3-sqs" format. It is giving a 403 error.  The code is provided below:

spark.readStream
.format("s3-sqs")
.option("fileFormat", "json")
.option("roleArn", roleArn)
.option("compression", "gzip")
.option("queueUrl", sqsUrl)
.option("badRecordsPath", badRecordsPath)
.option("maxFilesPerTrigger", 2500)
.schema(schema)
.load
 
However, the code below is working perfectly fine with the auto-loader
spark.readStream
.format("cloudFiles")
.option("cloudFiles.roleArn", roleArn)
.option("cloudFiles.format", "json")
.option("cloudFiles.maxFileAge", "14 days")
.option("cloudFiles.queueUrl", sqsUrl)
.option("cloudFiles.maxFilesPerTrigger", 2500)
.option("badRecordsPath", badRecordsPath)
.schema(schema)
.load

Can you please support me here?

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @Vaibhav1000The 403 error you're encountering with the "s3-sqs" format could be due to incorrect configuration or insufficient permissions.

You can try the following steps to resolve this issue:

1. Check your IAM role permissions: Ensure that the IAM role you're trying to assume has the necessary permissions to access the required resources.

2. Configure the IAM role correctly: You may need to set the IAM role for the "s3-sqs" format using the Hadoop configuration, similar to the method mentioned in the provided information.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!