Direkt zum Inhalt

How do I resolve Athena cross-account issues?

Lesedauer: 5 Minute
0

I want to resolve Amazon Athena cross-account query issues with AWS Glue Data Catalog and AWS Lake Formation shared resources.

Resolution

Data Catalog cross-account shared resources

If you used the Athena cross-account Data Catalog feature to access a catalog from another account, then you might get an "Access denied" error message. For example, you might get an "Access denied" error with Data Catalog API actions, such as GetDatabases or GetTable. If the bucket policy for the table's Amazon Simple Storage Service (Amazon S3) location doesn't grant access to the borrower account's role, then you might also get an error message.

To resolve, configure access for cross-account queries to the Data Catalog and the Amazon S3 bucket from an account other than your own.

To configure your Data Catalog permissions, create a borrower role with a policy to access the owner's AWS Glue resources. Then, create an owner policy to grant AWS Glue access to the borrower.

Then, register the owner's Data Catalog as a data source in Athena. Or, reference it directly with the catalog syntax.

Note: You can't query catalogs that you encrypted with AWS managed keys across accounts. Use a customer managed key.

For more information, see How can I provide cross-account access to resources in the AWS Glue Data Catalog?

To configure your Amazon S3 permissions, use a S3 bucket policy to grant cross-account access to users to run queries. For more information, see How do I provide cross-account access to objects that are in Amazon S3 buckets?

For S3 buckets encrypted with a custom AWS Key Management Service (AWS KMS) key, grant cross-account access to a bucket encrypted with a custom AWS KMS key. For more information, see Why do cross-account users receive Access Denied errors when they access my Amazon S3 objects that I encrypted with an AWS KMS customer managed key?

Lake Formation cross-account shared resources

"Insufficient Lake Formation permissions" error message

If you shared a Data Catalog resource when Lake Formation permissions were granted to the IAMAllowedPrincipals group for the resource, then you receive the following error message:

"Insufficient Lake Formation permissions: Illegal combination"

If your Cross account version settings are version 1, 2, or 3, then revoke all Lake Formation permissions from IAMAllowedPrincipals before you share the resource.

Important: If you revoke the permissions, then you remove IAM only access for existing users of the resource.

Or, update your cross-account version settings to version 4 or later to share resources that have IAMAllowedPrincipals permissions.

"HIVE_UNSUPPORTED_FORMAT" or "HIVE_METASTORE_ERROR" error message

If you didn't grant permissions on the target table, then the user receives one of the following error messages:

"HIVE_METASTORE_ERROR: Table is missing storage descriptor"

"HIVE_UNSUPPORTED_FORMAT: Table StorageDescriptor is null for table"

Permissions granted on a resource link don't grant permissions on the linked database or target table.

To explicitly grant permissions on the target table, complete the following steps:

  1. Open the Lake Formation console.
  2. In the navigation pane, choose Tables.
  3. In Tables, select your resource link.
  4. Choose Actions, and then choose Grant on target.
  5. In Grant data lake permissions, grant the permission SELECT and DESCRIBE.
    Note: Make sure that you grant the DESCRIBE permission to the principal on the resource link. Permissions on the target don't grant access to the resource link. For more information, see How resource links work in Lake Formation.
  6. Choose Grant.

"Permission denied on S3 path" or "PERMISSION_DENIED" error message

If the role doesn't have access to the S3 location, then you receive one of the following error messages:

"Permission denied on S3 path: s3://. . ."

"PERMISSION_DENIED: User: . . . is not authorized to perform: s3:GetObject"

"PERMISSION_DENIED: User: . . . is not authorized to perform: s3:ListBucket"

If you registered the table's Amazon S3 location with Lake Formation, then Athena reads the data with temporary credentials that Lake Formation vends for the role that you used to register the location. Make sure that this role has access to the S3 location and to the AWS KMS key. Grant the AWS KMS key permissions to the registration role, not to the querying principal.

If you didn't register the location, then make sure that the querying principal's IAM permissions allow access to the bucket and the key.

If the S3 location is in another account or you encrypted with an AWS managed key (aws/s3), then use a user-defined role instead of the AWSServiceRoleForLakeFormationDataAccess role. Grant the role permissions in the key policy of the AWS KMS key that encrypts the data. Then, re-register the location with the user-defined role. For more information, see Requirements for roles used to register locations.

Related information

How can I troubleshoot Lake Formation permission issues in Athena?

Query cross-account AWS Glue data catalogs using Amazon Athena

Troubleshooting Lake Formation issues

AWS OFFICIALAktualisiert vor 22 Tagen