AWS Athenaでテーブルを作る時にAccess Deniedと怒られたら試すこと

 · 2 min read

こんにちは。
はじめてAWS Athenaを使用してみました

試しにS3に置いてあるCSVをもとにテーブルを作ろうとしたらAccess Deniedのエラーが発生
権限は足りており、疎通確認もできているので、権限系の問題ではない。ではなぜ?

調べてみたらしょーもないところでドハマリしていたので、備忘録を残しておきます

エラーの詳細

出てきたエラーはこうです

Your query has the following error: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: XXXXXXXXXXXX), S3 Extended Request ID: XXXXXXX/XXXXXX

This query ran against the ‘default’ database, unless qualified by the query. Please post the error message on our forum or contact customer support with query id.

DDLのタスクにてAccess Deniedが起きているよ、とのこと
このエラーを見た時に真っ先に権限を疑ったのですが、AthenaとS3にFullAccessを付けても治らず

対応方法

AWSのページを見つけました

The S3 location should match the format s3://bucket/path; don’t include the endpoint. For example, s3://us-east-1.amazonaws.com/bucket/path would result in an “Access Denied” error.

Resolve “Access Denied” Errors When Running Amazon Athena Queries

えぇ…
ここで、実際の画面を見てみましょう

undefined

お分かりいただけただろうか。
プレースホルダがエンドポイントまで含めたURLを促しているのに対し、
バケットパスを入力する要素の下に、ヘルプテキストが書かれている

ちゃんと読んでいればハマらないんでしょうが、プレースホルダ見るじゃん。それに従うじゃん。 エラーになるじゃん
ということで納得はいかないのですが、治りはしました

AWSAWS Athena
© 2012-2022 Leko