![]() |
VOOZH | about |
Microsoft Power Automate is a cloud-based, low-code/no-code platform that makes it easy to automate repetitive tasks and streamline business processes across various applications and services.
CData API Server extends the capabilities of Power Automate by enabling access to data from multiple sources and applications—whether on-premises or in the cloud. With the Amazon Athena Connector in the API Server (or any of the hundreds of available connectors), you can natively create actions and complex workflows and trigger them in Power Automate using industry-standard data access protocols like OData and Swagger.
In this article, we'll set up Power Automate and CData API Server to create a simple trigger that sends an email or notification whenever a lead in a Amazon Athena table matches specific criteria.
Let's begin!
Here's a quick overview of the steps we'll follow:
CData provides the easiest way to access and integrate live data from Amazon Athena. Customers use CData connectivity to:
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.
If you haven't already, download an installer for your operating system from the CData API Server page. Follow the installation wizard to complete the setup on your machine.
Once installed, you can start the server in the following ways:
When Microsoft Power Automate and the CData API Server are hosted on different domains, CORS (Cross-Origin Resource Sharing) must be enabled to allow seamless cross-domain communication. To enable CORS in the API Server:
To authorize Amazon Athena requests, provide the credentials for an administrator account or for an IAM user with custom permissions: Set to the access key Id. Set 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.
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:
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 to true and leave and empty. The CData Data Provider for Amazon Athena 2018 will automatically obtain your IAM Role credentials and authenticate with them.
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 . 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 and of an IAM user to assume the role for. Roles may not be used when specifying the and of an AWS root user.
For users and roles that require Multi-factor Authentication, specify the and 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 (default 3600 seconds).
In addition to the and properties, specify , and . Set to the region where your Amazon Athena data is hosted. Set to a folder in S3 where you would like to store the results of queries.
If is not set in the connection, the data provider connects to the default database set in Amazon Athena.
To allow secure access to the created OData endpoints, create and configure Users in the CData API Server. Each user has authentication credentials and role-based access control, ensuring that only authorized users with appropriate roles can query the connected data.
Once a user is added, an Authtoken is automatically generated. This token can be used in API requests as a secure authentication method instead of a password.
You can also refresh the Authtoken, disable it, or set expiration rules (e.g., number of days until expiry) by enabling the Token Expiration option in the user settings.
👁 'Authtoken' Settings for the Added User in CData API ServerTo make data from Amazon Athena available in Power Automate via OData, you need to expose your desired tables through the API Server. Here's how:
Now that your API is configured, Power Automate can connect to the OData endpoints to automate tasks. Below are the URL formats for OData endpoints that you can use:
| Endpoint | URL | |
|---|---|---|
| Entity List | http://address:port/api.rsc/ | |
| Table Metadata (e.g., albums) | http://address:port/api.rsc/albums/$metadata?@json | |
| Table Data (e.g., albums) | http://address:port/api.rsc/albums |
These OData endpoints are now ready to be directly consumed in Power Automate using the URL. Since Power Automate supports OData, you can easily automate workflows, trigger actions, and integrate live data from Amazon Athena into your automated processes.
The CData API Server supports full OData filtering capabilities. For custom queries and filtered visualizations, you can append standard OData query parameters like $select, $filter, $orderby, $top, and $skip to your requests.
You've got the CData API Server up and running now with consumable OData endpoints from your Amazon Athena data. Now let's build a Power Automate flow to automate an email trigger based on a criteria.
In this example, we'll build a flow that reads lead and opportunity data from the Opportunity table in Amazon Athena. The flow will identify the lead with the highest value in the ExpectedRevenue column and automatically send an email containing the details of that lead.
We'll use Power Automate Desktop along with the Outlook app on Windows 11. If you don't have Outlook installed on your Windows machine, you can download it from the Microsoft 365 official site or install it via the Microsoft Store.
With full support for OData URL filters (OData ABNF) in CData API Server, you can filter your tables (resources) directly in the URL to limit and sort the results before they are even pulled into your flow. This reduces load time and improves efficiency. Check out the complete list of supported filter options here.
For our example, the filtered URL looks like this: http://localhost:8080/api.rsc/public_Opportunity?$top=1&$orderby=ExpectedRevenue desc
You can build your own endpoint URL like this. Here's what each part means:
| URL Part | Description |
|---|---|
| http://localhost:8080 | Base URL including hostname and port where your CData API Server is hosted |
| /api.rsc/ | The default endpoint path prefix used by CData to expose API resources |
| public_Opportunity | The table name (resource) you want to query—in this case, the public_Opportunity table |
| ? | Marks the beginning of query string parameters used for filtering, sorting, etc. |
| $top=1 | Returns only the first record from the filtered result set |
| $orderby=ExpectedRevenue desc | Sorts the results by the ExpectedRevenue column in descending order |
Top Lead Details: Account ID: %JsonAsCustomObject['value'][0]['AccountId']% Name: %JsonAsCustomObject['value'][0]['Name']% Expected Revenue: %JsonAsCustomObject['value'][0]['ExpectedRevenue']% Close Date: %JsonAsCustomObject['value'][0]['CloseDate']%
Your flow now sends an email when a new lead with the highest ExpectedRevenue is found. Since Power Automate Desktop doesn't support built-in scheduling, you'll need to use Windows Task Scheduler or Power Automate (cloud) to run it continuously at set intervals.
To avoid duplicate emails, use the Write text to file action in Power Automate to save the Id field to a file (e.g., lastLead.txt). On each run, use the Read text from file action to compare it with the current Id. If they match, skip the email—ensuring alerts are only sent for new leads.
This flow is just the beginning. You can extend it to update CRM records, log high-value leads to Excel, or send real-time Slack alerts—automating even more steps in your lead management process.
Build OData REST APIs with low-code/no-code platform and unlock seamless integration with your live data. Try CData API Server free for 30 days and experience how easily you can automate tasks using live data from Amazon Athena (or any of the hundreds of available connectors) in Power Automate.
Learn more or sign up for a free trial:
CData API Server