We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →Connect to Amazon Athena Data through External Services in Salesforce
Use CData Connect Cloud to securely connect Salesforce External Services with Amazon Athena Data using OpenAPI, exposing APIs to enable streamlined integration and secure, scalable, real-time data sharing across platforms.
CData Connect Cloud, enables you to access Amazon Athena data from cloud-based applications like the Salesforce and mobile applications like the Salesforce Mobile App. In this article, you will use CData Connect Cloud to access Amazon Athena data through Salesforce External Services.
About Amazon Athena Data Integration
CData provides the easiest way to access and integrate live data from Amazon Athena. Customers use CData connectivity to:
- Authenticate securely using a variety of methods, including IAM credentials, access keys, and Instance Profiles, catering to diverse security needs and simplifying the authentication process.
- Streamline their setup and quickly resolve issue with detailed error messaging.
- Enhance performance and minimize strain on client resources with server-side query execution.
Users frequently integrate Athena with analytics tools like Tableau, Power BI, and Excel for in-depth analytics from their preferred tools.
To learn more about unique Amazon Athena use cases with CData, check out our blog post: https://www.cdata.com/blog/amazon-athena-use-cases.
Getting Started
Connect to Amazon Athena from Salesforce
To work with live Amazon Athena data in Salesforce Connect, we need to connect to Amazon Athena from Connect Cloud, provide user access to the connection, and create OData endpoints for the Amazon Athena data.
(Optional) Add a New Connect Cloud User
As needed, create Users to connect to Amazon Athena through Connect Cloud.
- Navigate to the Users page and click Invite Users
- Enter the new user's email address and click Send to invite the user
- You can review and edit users from the Users page
Add a Personal Access Token
If you are connecting from a service, application, platform, or framework that does not support OAuth authentication, you can create a Personal Access Token (PAT) to use for authentication. Best practices would dictate that you create a separate PAT for each service, to maintain granularity of access.
- Click on your username at the top right of the Connect Cloud app and click User Profile.
- On the User Profile page, scroll down to the Personal Access Tokens section and click Create PAT.
- Give your PAT a name and click Create.
- The personal access token is only visible at creation, so be sure to copy it and store it securely for future use.
Connect to Amazon Athena from Connect Cloud
CData Connect Cloud uses a straightforward, point-and-click interface to connect to data sources.
- Log into Connect Cloud, click Connections and click Add Connection
- Select "Amazon Athena" from the Add Connection panel
-
Enter the necessary authentication properties to connect to Amazon Athena.
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:
- 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.
To obtain the credentials for your AWS root account, follow the steps below:
- 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.
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.
- Click Create & Test
Add a workspace and an asset to Virtual Datasets
Virtual Databases provide a new way to access, model, govern, and deliver data. A virtual database mimics a real database. Applications can connect like they normally would to a database, but the connection is a live data connection to the data source. Follow the given process to add a workspace to the Virtual dataset:
- Select Virtual Datasets in Connect Cloud and add a new workspace. Check the documentation link for further reference.
- Add a new asset in the workspace and select the required table from the Amazon Athena to update using Salesforce external services (to be demonstrated in the next section).
- Select View Endpoints -> OData. Copy the Username, OpenAPI URL, and PAT (generated in the previous section) and save them for future reference. Click Close.
Check the column data types of the selected table:
- Once the Amazon Athena data table is added as an asset, select the table, and note the column names and data types from the Column tab.
- In the Preview tab, preview the current data in the table to be referenced later.
- Click on Users from the left panel and search for your username, e.g. [email protected]. Click on the same.
- On the Edit Users screen, grant the respective user all Permissions (Select, Insert, Update, Delete, and Execute) for the entity (workspace).
Connect to Amazon Athena Data as an External Service
Create a Named Credential
Follow the steps below to connect to the OpenAPI produced by CData Connect Cloud with Salesforce:
- Log into Salesforce and navigate to Setup.
- Search for Named Credentials in the search bar and click on it.
- Select New -> New Legacy.
- Add the given details in the New Named Credential screen:
- Label: enter a label of your choice
- Name: enter a name for the named credential
- URL: https://cloud.cdata.com
- Identity Type: Named Principal
- Authentication Protocol: Password Authentication
- Username: enter your CData Connect Cloud username. This is displayed in the top-right corner of the CData Connect Cloud interface. For example, [email protected]
- Password: enter the PAT you generated on the Settings page
- Generate Authorization Header: enable the checkbox
Click Save to save the details.

Create an External Service
- Now, search for External Services in the search bar and click on it.
- In the Add an External Service page, click From API Specification under Select an API Source.
- In the Enter an Existing Service page, enter the given details under Modify Exiting Registration Details:
- External Service Name: enter an identifying name for your external service
- Description: enter a description of your external service (not a mandatory field)
- Service Schema: Relative URL
- Select a Named Credential: OpenAPI
- URL: copy enter the OpenAPI URL from Connect Cloud and remove https://www.cdata.com and keep the rest of the URL. Make sure the URL starts with a forward slash "/api...".
If the connection is successful, the message "Schema validation completed successfully!" will be displayed on the screen. Click Save & Next
- Select all the entities in the Select Operations screen. Click Next.
- All the schema-generated actions are displayed in the Review External Services Actions screen. Click Finish.
- The External Services page will display all the external services created.
Create a new Flow
- Search for Flows in the search bar and click on it.
- Click New Flow.
- Select Start From Scratch option and click Screen Flow.
- In the Flow Builder screen, click on the "" between Screen Flow and End.
- Select Screen from Add Element.
- In the New Screen window, enter "Input Screen" in Label and the API Name will be auto-filled accordingly.
- Next, based on the table you want to update, note the column data types to add the components to the flow. In the table we discussed in the article, we have column types such as int (orderid), varchar (ordername), and int (personid).
- Now, for the orderid column, search for the "Number" component in the Components search bar and click on it. Enter Label as "Enter Order ID" and again API Name will be auto-filled accordingly. Enable the Require checkbox and apply this for steps 9 and 10.
- For the ordername column, search for the "Text" component in the Components search bar and click on it. Enter Label as "Enter Order Name".
- For the personid column, search for the "Number" component in the Components search bar and click on it. Enter Label as "Enter Person ID".
- Click Done and Input Screen will be added in the Flow Builder.
- Now, add an element Action below the input screen in the flow.
- Under Search Actions, search and click the newly created external service, in this case, OpenAPI1.
- Click Create Orders.
- Enter a name in Label, the API Name gets auto filled.
- Click on the search bar under Set Input Values for the Selected Action and select New Resource -> Variable.
- In the New Resource window, enter the following details:
- Resource Type: Variable
- API Name: Body
- Data Type: Apex-Defined
- Apex Class: ExternalService_
_CDataWorkspace2e - Availability Outside the Flow:
- Available for input: enable checkbox
- Available for output: enable checkbox
- Availability Outside the Flow:
- Add a new element Assignment and add the Label name as "SendBody". Again, the API Name gets auto-filled.
- Set the given values under Set Variable Values:
- Variable: Body>orderid; Operator: Equals; Value: Input Screen>Enter Order ID
- Variable: Body>ordername; Operator: Equals; Value: Input Screen>Enter Order Name
- Variable: Body>personid; Operator: Equals; Value: Input Screen>Enter Person ID
- Add another Screen element below the Action element.
- Name the Label as "Display".
- Under Components, search for the "Display Text" component and click on it.
- Set the API Name as "Display_Result" and in the Inside a resource search bar, select Create a new order -> response code. Click Done.
- The flow is now ready. Click Save to save the flow and add a name to the Label as the flow name, in this case, "CreateOrdersPage". Click Save.
- The flow is displayed on the Flow Builder screen. Click on Activate to activate the flow.
Check the flow and verify the updated details in Connect Cloud
- Click Debug. The Debug flow window opens. Click Run.
- In the details input page, in this case, "CreateOrdersPage", enter the details (Orders ID, Orders Name, and Person ID) and click Next.
- The next page displays the message "200" (HTTP 200 - OK) and the right pane displays the debug details. Click Next.
- You can change the inputs or run the process again to enter new details.
- Check in Connect Cloud if the new details are updated in the "Orders" table, as this article outlines. This completes the process.
Simplified access to Amazon Athena data from cloud applications
At this point, you have a direct, cloud-to-cloud connection to live Amazon Athena data from Salesforce. For more details on accessing live data from over 100 SaaS, Big Data, and NoSQL sources through cloud applications, visit our CData Connect Cloud page.
Reach out to our Support Team if you have any questions.