Amazon Athena
- 1.Navigate to: Resources > Data Sources
- 2.Select the Amazon Athena Icon:

- Name (required)
- Description (optional)
- Region name (required):
- This should correspond to the region where your data is stored in S3
- Example:
us-west-1
- Access key ID:
-
- User Secret access key can be found in the IAM section for your specific user.
- Secret access key:
- User Secret access key can be found in the IAM section for your specific user.
Python
%python
# Connect to Athena. Returns: botocore.client.Athena object
client = z.getDatasource("zepl_docs_athena")
# Set parameter values for query execution
params = {
'region': 'us-west-1',
'database': 'default',
'bucket': 'shainsky-athena-demo',
'path': 'athena_queries',
'query': ( """ SELECT os, COUNT(*) count
FROM default.cloudfront_logs
WHERE date BETWEEN date '2014-07-05' AND date '2014-08-05'
GROUP BY os
""")
}
# Execute query in athena and return result files to the S3 bucket specificed at OutputLocation path
response = client.start_query_execution(
QueryString=params['query'],
QueryExecutionContext={
'Database': params['database']
},
ResultConfiguration={
'OutputLocation': 's3://' + params['bucket'] + '/' + params['path']
}
)
- 1.Login to AWS
- 2.Navigate to IAM > Users
- 3.Select your user name
- 4.Select Add permissions, to make sure your user has the required permissions to support the level of access required. AmazonAthenaFullAccess - Grants access to all actions and all resources
- 5.Select Security credentials > Create access key
- 6.Download .csv file - This file contains the key that will be entered into Zepl's Athena Data Source. DO NOT LOSE THIS file.
Last modified 2yr ago