- Newest
- Most votes
- Most comments
Hello,
To access a glue job in a cross region scenario "us-west-1" and "us-east-2", where the raw parquet data is in us-west-1 region and the glue data catalog(Iceberg table) is in the us-east-2 region.
There are only 2 methods that you can follow as the workaround to solve this issue:
- Using S3 Access Point:
When following Spark configs are provided, cross region S3 access works.
The S3 Access points is supported in Iceberg 0.14.0 & the later versions and you can only use these configurations on those versions. Additionally, you need to configure S3 access point for the S3 bucket in advance.
spark.sql.catalog.{catalog_name}.s3.use-arn-region-enabled=true
spark.sql.catalog.{catalog_name}.s3.access-points.{bucketName}=arn:aws:s3:{region}:{account}:accesspoint/{s3accessPointName})
Note: This suggestion requires to locate both Glue database/table and S3 in the same region. It is not possible to locate Glue table in us-east-2 and S3 bucket in us-west-1.
- Using AssumeRole:
The IAM role attached to the Glue job need to be able to assume the role specified in the below configuration.
-> The source IAM role (attached to the job): Need to have sts:AssumeRole action in IAM policy. -> The target IAM role (assumed by the config): Need to allow sts:AssumeRole action from the source IAM role in trust relationship.
spark.sql.catalog.{catalog_name}.client.factory=org.apache.iceberg.aws.AssumeRoleAwsClientFactory
spark.sql.catalog.{catalog_name}.client.assume-role.arn=arn:aws:iam::{account}:role/{roleName}
spark.sql.catalog.{catalog_name}.client.assume-role.region={region}
By implementing this based on the requirements of the job will resolve this issue.
Additionally, if your use-case permits, you can use Amazon Athena for reading the table, as it supports cross region without any conflicts.
However, if you continue to face any issue, to do a thorough analysis for your architecture and script I would suggest you create a case with technical support to help you with this.
answered 2 years ago
To resolve this cross-region issue and ensure your Glue job runs correctly, you need to make a few modifications to your Spark configuration and Glue job setup:
- Update your Spark configuration to explicitly set the Glue catalog region:
Add the following configuration to your Spark session builder:
.config("spark.sql.catalog.glue_catalog.catalog-impl", "org.apache.iceberg.aws.glue.GlueCatalog") .config("spark.sql.catalog.glue_catalog.warehouse", f"s3://{dest_bucket}/iceberg-data/") .config("spark.sql.catalog.glue_catalog.io-impl", "org.apache.iceberg.aws.s3.S3FileIO") .config("spark.sql.catalog.glue_catalog.glue.region", "us-east-2")
- Modify your IAM role permissions:
Ensure that your IAM role has permissions to access the Glue Data Catalog in us-east-2. Update your policy to explicitly allow actions on resources in us-east-2:
{ "Effect": "Allow", "Action": [ "glue:GetDatabase", "glue:GetTable", "glue:CreateTable", "glue:UpdateTable" ], "Resource": [ "arn:aws:glue:us-east-2:${account_id}:catalog", "arn:aws:glue:us-east-2:${account_id}:database/*", "arn:aws:glue:us-east-2:${account_id}:table/*" ] }
- In your Glue job configuration:
Set the default arguments to include the Glue region:
default_arguments = { "--additional-python-modules" = "boto3==1.24.70" "--conf" = "spark.sql.catalog.glue_catalog.glue.region=us-east-2" "--enable-glue-datacatalog" = "true" // ... other arguments ... }
- Ensure your Glue job is created in the correct region:
Make sure your aws_glue_job resource in Terraform is created in us-west-1, where the job will run:
resource "aws_glue_job" "parquet_to_iceberg" { provider = aws.west // ... other configurations ... }
- Cross-region S3 access:
Ensure your IAM role has permissions to read from the source bucket in us-west-1 and write to the destination bucket in us-east-2.
By implementing these changes, your Glue job should be able to run in us-west-1, process the data there, and correctly interact with the Glue Data Catalog in us-east-2 for Iceberg table operations. This setup directs all Glue catalog operations to us-east-2 while allowing the job to run and access data in us-west-1.
Sources
Glue ETL: cross region write to Iceberg failing | AWS re:Post
Running ETL jobs on Amazon S3 tables with AWS Glue - Amazon Simple Storage Service
Working with Apache Iceberg in AWS Glue - AWS Prescriptive Guidance
Cross-account cross-Region access to DynamoDB tables - AWS Glue
answered 2 years ago
Relevant content
asked 3 years ago
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago

I have already tried it, This doesn't work. I have also tried giving the updating the role to have below policy, just to check what glue job is upto -
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:GetTable", "glue:GetDatabase" ], "Resource": [ "arn:aws:glue:us-west-1:111:catalog", "arn:aws:glue:us-west-1:111:database/iceberg_database", "arn:aws:glue:us-west-1:111:table/iceberg_database/my_iceberg_table" ] } ] }
got this Error:
An error occurred while calling o113.createOrReplace. Database iceberg_database not found. (Service: Glue, Status Code: 400, Request ID: 111)
My observation: Glue (and Apache Iceberg) will try to use the local region’s hence causing all such issues