Skip to Content
Technical Articles
Author's profile photo Sohit Tandon

Using the HANA Cloud Athena api adapter to access S3 data

Using the SAP HANA Cloud Athena api adapter to access S3 data

In this blog post we will explore how to access csv data from Amazon S3 into SAP HANA Cloud.

This can be a handy approach when customers want to ingest S3 data directly into HANA Cloud.

  • You should have admin access to AWS console, along with the Access Key ID and the secret access key for the AWS user.
  • You have a SAP Cloud Platform access and a SAP HANA Cloud instance
Log into the AWS console and perform the below steps.
  1. Edit your AWS user and add the following two policies to your user
    • AWSQuicksightAthenaAccess
    • AmazonAthenaFullAccess

  1. Create a S3 bucket in AWS and create two folders, one for uploading the csv data file and the other to store query results.


  1. 3. Create an AWS Athena service and configure it to consume data from the S3 bucket.
    • First create an Athena service and then click on the “set up a query results location in Amazon S3

    • Set the query results location to the S3 folder

    • Click on the workgroup and add the query results location there as well

  1. Create an Athena database and a table based on the csv file. Use the create table (from S3 bucket data) wizard in the query editor.

The wizard will ask for database name, table name, S3 location, data format, column names and datatypes. Once the wizard creates the table, you can query it like below screenshot


Now we will go to our SAP Cloud Platform and then click SAP HANA Cloud


  1. Open the SAP HANA database explorer from the Open in option under the SAP HANA service information. Note that you need to have CREATE REMOTE SOURCE system privilege. If your user does not have this privilege ask your administrator to grant it .
  1. The Athena adapter needs both Athena and S3 certificates for TLS/SSL. Download the required root certificates from the following sites: (Amazon Root CA 1)

        https://<bucket_name> (Baltimore CyberTrust Root)

   I would suggest downloading ALL the certificates from these 2 sites. has five certificates
           has 3 certificates.


  1. Once the certificates are downloaded, you will need to run the below set of commands to create a PSE, add the certificates and set a purpose

       -----BEGIN CERTIFICATE-----
        ## lines are remove##
       -----END CERTIFICATE-----

  • Repeat the above create certificate from command for all the eight certificates.
  • Add the certificates to the above created PSE

  • Set the purpose of the PSE to remote source using the below SQL
Here is a screen shot of my certificate store one the above exercise is done


  1. Now you can create a new remote source by right clicking remote source in the database explorer. You will need your Access Key ID and the secret access key for the AWS user and will need to choose Athena as the adapter.
  2. You will be able to see databases and tables you created in Athena. You can now check the box against the table name and then create a virtual object .


  1. Now you will be able to see the table1 in schema DBADMIN.
  1. You can display the data of the S3 bucket in HANA Cloud.


In this blog post, we created a S3 bucket and loaded csv file into it. We then created a Athena table on it.

There after we created a remote source using the SAP HANA Cloud Athena api adapter and created a table in SAP HANA Cloud which was accessing data from the AWS athena. With the right configurations on AWS and the right SSL certificates in SAP HANA Cloud, it is quite simple to consume the S3 data into SAP HANA Cloud..



Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Gaurav Jowhry
      Gaurav Jowhry

      Well documented