简体   繁体   English

Athena 查询不同账户中的表

[英]Athena queries between tables in different accounts

I can individually access two different Athena tables using two different IAM roles because each lie in different accounts.我可以使用两个不同的 IAM 角色分别访问两个不同的 Athena 表,因为每个角色都位于不同的账户中。

Is there a way to run a single query that pulls from both (ie. INNER JOIN)?有没有一种方法可以运行从两者中提取的单个查询(即 INNER JOIN)?

Under the hood, Athena table data is in S3 bucket .在幕后, Athena 表数据位于 S3 存储桶中。

Athena supports cross-account S3 bucket access. Athena 支持跨账户 S3 存储桶访问。

Assume you've Account A & B and Athena table TableA and TableB respectively.假设您分别有帐户 A 和 B 以及 Athena 表 TableA 和 TableB。

Steps to run query from AccountA Athena (access cross-account data):从 AccountA Athena 运行查询的步骤(访问跨账户数据):

  1. Provide AccountA IAM Role read access on AccountB S3 bucket Policy (where TableB data resides).为 AccountA IAM 角色提供对 AccountB S3 存储桶策略(TableB 数据所在的位置)的读取访问权限。

  2. Create TableB in AccountA Athena, referring to S3 bucket data in AccountB.在 AccountA Athena 中创建 TableB,引用 AccountB 中的 S3 bucket 数据。

  3. Use TableA & and TableB in AccountA and do Inner join在 AccountA 中使用 TableA & 和 TableB 并进行内连接

Ref (cross-account access): https://aws.amazon.com/athena/faqs/ Ref(跨账户访问): https://aws.amazon.com/athena/faqs/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM