Search code examples
amazon-web-servicesamazon-cloudfrontamazon-athena

Set different output result location for different tables in aws athena


I have enabled cloudfront logs and want to capture some information through that.

For that I am using aws athena to query cf logs. Which is absolutely working fine for my staging environment as it will store query result in my staging bucket.

For production I have created another table which will query cf logs files from production bucket and that result I want to store it in different s3 bucket( production bucket). But I am not finding any way to have different output query result location. Is there any way i can set different output result location for different tables


Solution

  • I assume you are talking about the QueryResultLocation in S3:

    QueryResultsLocationInS3 is the query result location specified either by workgroup settings or client-side settings.

    You can find more detailed information on how to set the location in Specifying a Query Result Location:

    The query result location that Athena uses is determined by a combination of workgroup settings and client-side settings. Client-side settings are based on how you run the query.

    • If you run the query using the Athena console, the Query result location entered under Settings in the navigation bar determines the client-side setting.
    • If you run the query using the Athena API, the OutputLocation parameter of the StartQueryExecution action determines the client-side setting.
    • If you use the ODBC or JDBC drivers to run queries, the S3OutputLocation property specified in the connection URL determines the client-side setting.