<aside> 💡 참고자료 공식문서
</aside>

이것은 AWS Athena 서비스로 쿼리를 날려 결과를 비동기, 동기적으로 JSON 형태로 깔끔히 받을 수 있다.
IAM Role 설정 필요(Lambda, EC2 뭐든)aws-sdk conf 설정 필요(NodeJS 앱으로 구동시)AmazonAthenaFullAccess, AmazonS3FullAccess"use strict";
const AthenaExpress = require("athena-express"),
AWS = require("aws-sdk");
/* AWS Credentials are not required here
/* Make sure the IAM Execution Role used by this Lambda
/* has the necessary permission to execute Athena queries
/* and store the result in Amazon S3 bucket
/* See configuration section above under Setup for more info */
const athenaExpressConfig = {
aws: AWS,
db: "myapp_cf_access_logs_db",
getStats: true
};
const athenaExpress = new AthenaExpress(athenaExpressConfig);
exports.handler = async event => {
const sqlQuery = "SELECT * FROM myapp_cf_access_logs_db.combined limit 1";
try {
let results = await athenaExpress.query(sqlQuery);
return results;
} catch (error) {
return error;
}
};