created: 2019-10-02T22:38:18.000Z

.athenaclirc の使い方

athenacli というCLIからathenaにクエリできるツールがある
これのathenaclircファイルの記法がドキュメントになかったのでメモ

結論

こんな形式のファイルを用意して

[aws_profile myprofile]

aws_access_key_id = 'AKIxxxxxxx'
aws_secret_access_key = 'SNMcxxxxxx-xxxx'
region = 'ap-northeast-1'
s3_staging_dir = 's3://aws-athena-query-results-ap-northeast-1/adhoc'

こんな感じでクエリを投げる

$ athenacli --profile myprofile --athenaclirc ./.athenaclirc -e 'show databases'

説明

--profile というオプションがあるが、 これは ~/.aws/credential を見てくれるものではない

設定ファイル (toml?) 内でどの aws_profile の設定を見るかというもの ちなみに引数に指定しないと default というプロファイルが使われる

その場合はこんな設定ファイルを書くことになる

[aws_profile default]

aws_access_key_id = 'AKIxxxxxxx'
...

.athenaclircの形式

.athenaclircファイルはconfigobjというモジュールでパースされている

とくに何らか標準のファイルフォーマットではないようだ (pythonっぽい独自のフォーマット)

詳解 Terraform 第3版 ―Infrastructure as Codeを実現する
[ad] 詳解 Terraform 第3版 ―Infrastructure as Codeを実現する
Yevgeniy Brikman, 松浦 隼人 (単行本(ソフトカバー))