Is there a Command line tool to access Amazon Athena

0 votes
I am looking for a command line tool so that I can make queries to Amazon Athena. It should work with JDBC, using the driver com.amazonaws.athena.jdbc.AthenaDriver,

but I haven't found any command line tool that works with it. Can someone help me with this?
Jan 16, 2019 in AWS by Anjali
• 2,950 points

1 answer to this question.

0 votes

The AWS command line tool supports Amazon Athena operations.

1. Attach the AmazonAthenaFullAccess policy to the IAM role of the calling user.

Then, to get started querying, you will use the start-query-execution command as follows:

aws athena start-query-execution 
    --query-string "SELECT * FROM MyDb.MyTable" 
    --result-configuration "OutputLocation"="s3://MyBucket/logs" [Optional: EncryptionConfiguration]
    --region <region>

This will return a JSON object of the QueryExecutionId, which can be used to retrieve the query results using the following command:

aws athena get-query-results
    --query-execution-id <id>
    --region <region>

Which also returns a JSON object of the results and metadata.

More information can be found in the official AWS Documentation.

Hope this helps!

answered Jan 16, 2019 by rishab

Related Questions In AWS

0 votes
2 answers

How to configure Amazon EC2 command line interface?

You can use this command to create ...READ MORE

answered Feb 23, 2019 in AWS by Shashank
• 1,370 points
+1 vote
2 answers

Is there a API to get AWS Marketplace Products

AWS Marketplace Entitlement Service API Reference The AWS ...READ MORE

answered Aug 1, 2018 in AWS by findingbugs
• 4,790 points
+3 votes
6 answers

How to move files from amazon ec2 to s3 bucket using command line

Hey, 3 ways you can do this: To ...READ MORE

answered Oct 9, 2018 in AWS by Omkar
• 69,150 points
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

Is it possible to add a compatibility layer above AWS?

Well there are few tools like TyphoonAE ...READ MORE

answered Jan 15, 2019 in AWS by Archana
• 5,640 points
0 votes
2 answers