Configure Athena to use a deployed Hive metastore connector
After you have deployed a Lambda data source connector like
AthenaHiveMetastoreFunction
to your account, you can configure Athena to use
it. To do so, you create a data source name that refers to your external Hive metastore to
use in your Athena queries.
To connect Athena to your Hive metastore using an existing Lambda function
Open the Athena console at https://console.aws.amazon.com/athena/
. If the console navigation pane is not visible, choose the expansion menu on the left.
-
Choose Data sources.
-
On the Data sources page, choose Create data source.
-
On the Choose a data source page, for Data sources, choose S3 - Apache Hive metastore.
-
Choose Next.
-
In the Data source details section, for Data source name, enter the name that you want to use in your SQL statements when you query the data source from Athena (for example,
MyHiveMetastore
). The name can be up to 127 characters and must be unique within your account. It cannot be changed after you create it. Valid characters are a-z, A-Z, 0-9, _ (underscore), @ (at sign) and - (hyphen). The namesawsdatacatalog
,hive
,jmx
, andsystem
are reserved by Athena and cannot be used for data source names. -
In the Connection details section, use the Select or enter a Lambda function box to choose the name of the function that you just created. The ARN of the Lambda function displays.
-
(Optional) For Tags, add key-value pairs to associate with this data source. For more information about tags, see Tag Athena resources.
-
Choose Next.
-
On the Review and create page, review the data source details, and then choose Create data source.
-
The Data source details section of the page for your data source shows information about your new connector.
You can now use the Data source name that you specified to reference the Hive metastore in your SQL queries in Athena.
In your SQL queries, use the following example syntax, replacing
ehms-catalog
with the data source name that you specified earlier.SELECT * FROM ehms-catalog.CustomerData.customers
-
To view, edit, or delete the data sources that you create, see Manage your data sources.