Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Add Amazon Athena Data to Informatica Enterprise Data Catalog
Use the CData JDBC Driver for Amazon Athena with the Informatica Enterprise Data Catalog to classify and organize data.
Informatica provides a powerful, elegant means of transporting and transforming your data. By utilizing the CData JDBC Driver for Amazon Athena, you are gaining access to a driver based on industry-proven standards that integrates seamlessly with Informatica's Enterprise Data Catalog. This tutorial shows how to classify and organize Amazon Athena data across any environment.
Load the JDBC Driver
To load the JDBC Driver:
- Install the JDBC Driver on the host running Informatica. For this article, it is assumed that the driver was installed into cdata.jdbc.amazonathena.AmazonAthenaDriver.
- Navigate to the JDBC install directory and create a zip file called genericJDBC.zip containing the driver and its license file.
- Move the genericJDBC.zip file into the Catalog Service directory within Informatica. For this article, it is assumed that Informatica is installed into /opt/informatica. Working in this folder will probably require root permissions, so make sure to su or sudo to root before continuing.
- Edit the custom deployment configuration to unpack the zip file.
- Refresh the Catalog Service from the Admin console.
$ java -jar setup.jar
$ cd ~/cdata-jdbc-driver-for-amazonathena/lib
$ zip genericJDBC.zip cdata.jdbc.amazonathena.jar cdata.jdbc.amazonathena.lic
# mv genericJDBC.zip /opt/informatica/services/CatalogService/ScannerBinaries
# cd /opt/informatica/services/CatalogService/ScannerBinaries/CustomDeployer/
# nano scannerDeployer.xml
After unpacking the existing ExecutionContextProperty nodes, add a new ExecutionContextProperty node with this content.
<ExecutionContextProperty
isLocationProperty="true"
dependencyToUnpack="genericJDBC.zip">
<PropertyName>JDBCScanner_DriverLocation</PropertyName>
<PropertyValue>scanner_miti/genericJDBC/Drivers</PropertyValue>
</ExecutionContextProperty>
Configure the JDBC Resource
To configure the JDBC resource:
- Open the Catalog administrator and add a new JDBC resource with the following properties:
- Driver Class: cdata.jdbc.amazonathena.AmazonAthenaDriver
- URL: jdbc.amazonathena:AWSAccessKey='a123';AWSSecretKey='s123';AWSRegion='IRELAND';Database='sampledb';S3StagingDirectory='s3://bucket/staging/';
- Sign into the IAM console.
- In the navigation pane, select Users.
- To create or manage the access keys for a user, select the user and then select the Security Credentials tab.
- Sign into the AWS Management console with the credentials for your root account.
- Select your account name or number and select My Security Credentials in the menu that is displayed.
- Click Continue to Security Credentials and expand the Access Keys section to manage or create root account access keys.
- Username: user
- Password: password
- Configure the metadata options to perform at least one source metadata scan. This scan uses the driver to determine what tables, views, and stored procedures are available through the service.
- Source Metadata: Enable this option.
- Catalog: Set this to the appropriate catalog for multi-catalog data sources. Otherwise, set this to CData.
- Schema: Set this to the appropriate schema for multi-schema data sources. Otherwise, set this to the name of the service (for example, Couchbase).
- Case-sensitivity: Generally this option should be disabled. Enable it only for data sources which are case-sensitive.
- Import stored procedures: Enable this if you want to import stored procedure definitions in addition to tables and views.
- Complete the driver configuration, optionally configuring custom attributes and a scanner schedule.
- Perform the metadata scan by navigating to the Monitoring tab and clicking Run. Depending upon the data source, this may takes a few minutes.
Authenticating to Amazon Athena
To authorize Amazon Athena requests, provide the credentials for an administrator account or for an IAM user with custom permissions: Set AccessKey to the access key Id. Set SecretKey to the secret access key.
Note: Though you can connect as the AWS account administrator, it is recommended to use IAM user credentials to access AWS services.
Obtaining the Access Key
To obtain the credentials for an IAM user, follow the steps below:
To obtain the credentials for your AWS root account, follow the steps below:
Authenticating from an EC2 Instance
If you are using the CData Data Provider for Amazon Athena 2018 from an EC2 Instance and have an IAM Role assigned to the instance, you can use the IAM Role to authenticate. To do so, set UseEC2Roles to true and leave AccessKey and SecretKey empty. The CData Data Provider for Amazon Athena 2018 will automatically obtain your IAM Role credentials and authenticate with them.
Authenticating as an AWS Role
In many situations it may be preferable to use an IAM role for authentication instead of the direct security credentials of an AWS root user. An AWS role may be used instead by specifying the RoleARN. This will cause the CData Data Provider for Amazon Athena 2018 to attempt to retrieve credentials for the specified role. If you are connecting to AWS (instead of already being connected such as on an EC2 instance), you must additionally specify the AccessKey and SecretKey of an IAM user to assume the role for. Roles may not be used when specifying the AccessKey and SecretKey of an AWS root user.
Authenticating with MFA
For users and roles that require Multi-factor Authentication, specify the MFASerialNumber and MFAToken connection properties. This will cause the CData Data Provider for Amazon Athena 2018 to submit the MFA credentials in a request to retrieve temporary authentication credentials. Note that the duration of the temporary credentials may be controlled via the TemporaryTokenDuration (default 3600 seconds).
Connecting to Amazon Athena
In addition to the AccessKey and SecretKey properties, specify Database, S3StagingDirectory and Region. Set Region to the region where your Amazon Athena data is hosted. Set S3StagingDirectory to a folder in S3 where you would like to store the results of queries.
If Database is not set in the connection, the data provider connects to the default database set in Amazon Athena.
Built-In Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Amazon Athena JDBC Driver. Either double-click the .jar file or execute the .jar file from the command-line.
java -jar cdata.jdbc.amazonathena.jar
Fill in the connection properties and copy the connection string to the clipboard.
When you configure the JDBC URL, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.
Typical additional connection string properties follow:
JDBC;MSTR_JDBC_JAR_FOLDER=PATH\TO\JAR\;DRIVER=cdata.jdbc.amazonathena.AmazonAthenaDriver;URL={jdbc:amazonathena:AWSAccessKey='a123';AWSSecretKey='s123';AWSRegion='IRELAND';Database='sampledb';S3StagingDirectory='s3://bucket/staging/';};
Note that the Username and Password properties are required, even if the driver you are using does not require them. In those cases, you can enter a placeholder value instead.
Other metadata scanners may be enabled as desired.
When the scan is complete, a summary of all of the metadata objects is displayed along with the status of the Metadata Load job. If any errors occur, you can open the Log Location link for the job to see the errors reported by Informatica or the driver.
Validate the Discovered Metadata
Open the Catalog Service browser to view the metadata extracted from the data source. Depending upon the options you selected when configuring the metadata scanner, you may see any combination of tables, views, and stored procedures for the resource you defined.