- Newest
- Most votes
- Most comments
Based on your error message, you're encountering a permission issue when trying to write to your Iceberg table in an S3 table bucket. The "Access Denied (Service: S3, Status Code: 403)" error indicates that the IAM role or user executing your Spark job doesn't have sufficient permissions to write to the S3 location.
Here are some steps to resolve this issue:
- Check IAM permissions: Ensure your IAM role has the necessary permissions for both S3 and AWS Glue. You'll need at minimum:
s3:GetBucketLocations3:GetObjects3:ListBuckets3:PutObjectglue:*(or more specific Glue permissions)
-
Verify S3 table bucket permissions: S3 table buckets have specific permission requirements. Make sure your role has the
AmazonS3TablesFullAccesspolicy attached (which you mentioned you have). -
Check your Spark configuration: Your configuration looks mostly correct, but ensure the warehouse path is properly set. For S3 table buckets, the warehouse path should point to the S3 table bucket location.
-
Try using explicit table properties: When writing to the table, you might want to specify additional table properties:
scd2_table.writeTo(f"{namespace}.{table_name_iceberg}") \ .option("write-format", "parquet") \ .tableProperty("format-version", "2") \ .append()
-
Verify table existence: Make sure the table already exists before attempting to append data. If it doesn't exist, use
.createOrReplace()instead of.append(). -
Check cross-account permissions: If you're working across AWS accounts, ensure proper cross-account access is configured.
-
Verify region settings: Ensure the region in your Spark configuration matches the region where your S3 table bucket is located.
If you're still encountering issues after checking these items, you might need to examine CloudTrail logs to see the specific permission that's being denied, or check if there are any bucket policies or ACLs restricting access to your S3 table bucket.
Sources
Working with Iceberg tables by using Apache Spark - AWS Prescriptive Guidance
Use an Iceberg cluster with Spark - Amazon EMR
Using the Iceberg framework in AWS Glue - AWS Glue
How to write data into S3 table buckets with Glue Job Spark | AWS re:Post
answered a year ago
Relevant content
asked a year ago
asked a year ago
- AWS OFFICIALUpdated 4 months ago

My glue job has full s3 and s3table bucket permission and has ALL permission in lakeformation on ALL_TABLES. The suggestion did not resolve my problem.