When your data lives in one AWS account and your Glue Crawler runs in another, you need to set up cross-account permissions on both sides. This guide shows you how to grant a Glue Crawler cross-account S3 bucket access by configuring the S3 bucket policy in the source account and the IAM role in the Glue account.
Architecture Overview
| Account A (Glue) | Account B (S3 Data) | |
|---|---|---|
| Account ID | ACCOUNT_A_ID |
ACCOUNT_B_ID |
| What it has | Glue Crawler, Glue Data Catalog, IAM role | S3 bucket with the source data |
| What you configure | IAM role with S3 + Glue permissions | S3 bucket policy allowing Account A |
Both sides need to allow the access. the bucket policy in Account B grants permission, and the IAM role in Account A gives the Glue Crawler the ability to use it.
Step 1: Add a Bucket Policy in Account B
Create the crawler role in Account A first so its ARN exists. Then in Account B, open the bucket’s Permissions tab and merge these statements into the bucket policy. Replace the named placeholders and set the same prefix in the policy and crawler target.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::your-data-bucket",
"Condition": {
"StringLike": {
"s3:prefix": [
"path/to/data",
"path/to/data/*"
]
}
},
"Principal": {
"AWS": "arn:aws:iam::ACCOUNT_A_ID:role/AWSGlueServiceRole-crawler"
}
},
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-data-bucket/path/to/data/*",
"Principal": {
"AWS": "arn:aws:iam::ACCOUNT_A_ID:role/AWSGlueServiceRole-crawler"
}
}
]
}
This example crawls ordinary files such as CSV, JSON, and Parquet. It grants listing at the specified prefix and object reads below it. Delta Lake sources have additional permissions. With Bucket owner enforced, Account B owns all objects and ACLs are disabled. For older buckets with ACLs enabled, check ownership of objects uploaded from other accounts before relying on the bucket policy alone. Review existing writers before changing Object Ownership.
Step 2: Create the Glue IAM Role in Account A
In Account A (where the Glue Crawler runs), create an IAM role that the Glue service can assume.
Trust policy
This trust policy allows the Glue service to assume the role:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "glue.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Permissions policy
Attach the AWS managed AWSGlueServiceRole policy for Data Catalog and CloudWatch Logs permissions. Add this inline policy for the data source. Confirm the managed policy fits your account’s access requirements before attaching it.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::your-data-bucket",
"Condition": {
"StringLike": {
"s3:prefix": [
"path/to/data",
"path/to/data/*"
]
}
}
},
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-data-bucket/path/to/data/*"
}
]
}
For cross-account SSE-KMS reads, the objects must use a customer-managed key. Allow kms:Decrypt on that key ARN in the crawler role’s IAM policy and allow the role in the key owner’s key policy (Account B if it owns the key). An AWS managed aws/s3 key cannot grant the crawler role cross-account decrypt access. See S3 SSE-KMS requirements.
If you manage roles centrally, see deploying IAM roles with CloudFormation StackSets.
Step 3: Create the Glue Crawler
In the AWS Glue console in Account A:
- Go to Crawlers > Create crawler
- Set the data source to S3 and enter the path:
s3://your-data-bucket/path/to/data/ - For the IAM role, select the role you created in Step 2
- Choose the target database in the Glue Data Catalog (or create a new one)
- Run the crawler
If the crawler fails with an “Access Denied” error, double-check that both the bucket policy and the IAM role policy use the same S3 actions and resource ARNs.
For the CLI equivalent, use a profile for Account A and the Region of the target database. Create the database first. The caller needs permission to create and start the crawler and iam:PassRole for the crawler role.
aws glue create-crawler --profile glue-account --region your-region \
--name cross-account-data \
--role "arn:aws:iam::ACCOUNT_A_ID:role/AWSGlueServiceRole-crawler" \
--database-name your-database \
--targets '{"S3Targets":[{"Path":"s3://your-data-bucket/path/to/data/"}]}'
aws glue start-crawler --profile glue-account --region your-region \
--name cross-account-data
If you configure the crawler to use Lake Formation credentials, follow the separate Lake Formation cross-account setup. Register the S3 location in Account B and share the database and data location access with Account A. In Account A, grant the crawler role data location access and lakeformation:GetDataAccess, create the resource link, and grant the documented database and link permissions. Select Lake Formation credentials on the crawler and identify the account that registered the location.
Troubleshooting
| Error | Likely Cause |
|---|---|
| Access Denied on S3 | Bucket policy in Account B does not allow the crawler role for the requested prefix |
| Access Denied on S3 (role is correct) | The IAM role in Account A is missing the S3 permissions. both sides must allow |
| Crawler runs but finds no tables | Check the S3 prefix, classifiers, and Lake Formation grants if enabled |
| Crawler can’t write to Data Catalog | The IAM role is missing glue:CreateTable or glue:UpdateTable permissions |
| KMS decrypt error | Confirm the object uses a customer-managed key and both the role policy and key policy allow kms:Decrypt |
Conclusion
Cross-account Glue Crawler access requires matching permissions on both sides: a bucket policy in the data account and an IAM role with S3 + Glue permissions in the crawler account. Keep the policies scoped to the minimum actions the crawler needs.
For other cross-account patterns, see How to Copy S3 Bucket Objects Across AWS Accounts or how to upload to S3 cross-account with AWS Lambda.


