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 in AWS by Anjali
• 2,900 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 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 in AWS by Shashank
• 1,350 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,750 points
+3 votes
5 answers

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

First Option sm3cmd Use s3cmd s3cmd get s3://AWS_S3_Bucket/dir/file Take a ...READ MORE

answered Aug 29, 2018 in AWS by Priyaj
• 56,160 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 14 in AWS by Archana
• 5,480 points
0 votes
1 answer

How to store Amazon Athena Query Results into new Table?

This is not supported by Athena as Amazon ...READ MORE

answered Jan 16 in AWS by heena