Connect to Salesforce from AWS Lambda using JDBC driver

Pre-requisite

Introduction

AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of the Amazon Web Services. Although AWS has out of the box solutions for connecting to RDS and Redshift, there would be scenarios where you would find yourselves needing to connect to a different datasource, which might be a SaaS data or Big data or No SQL data or the good old relational databases. One of the ways that you can connect to these data sources is by using Progress DataDirect JDBC drivers.

In this tutorial, we will walk you through how you can connect to Salesforce from AWS Lambda using Progress DataDirect JDBC driver.

Back to top

Download & Install Progress DataDirect Salesforce driver

To install the driver, you would have to execute the .jar package and you can do it by running the following command in terminal or just by double clicking on the jar package.
java -jar PROGRESS_DATADIRECT_JDBC_SF_ALL.jar

This will launch an interactive java installer using which you can install the Salesforce JDBC driver to your desired location as either a licensed or evaluation installation.

Note that this will install Salesforce JDBC driver and bunch of other drivers too for your trial purposes in the same folder.

Back to top

Write and Deploy Lambda Function

Create a new AWS Lambda Java Project in Eclipse, by following this tutorial from AWS.

After you have created the Project, add Progress DataDirect Salesforce driver (sforce.jar) to the build path. The driver would be present in the install location you have chosen previous section.

The above code connects to Salesforce, queries a table -- which you can provide as an input to AWS Lambda function.

Fill in the Username, Password and Security Token in the above code. Build the code.

Upload the code to AWS Lambda as shown below:

Now, run the function on AWS Lambda, by using the same context menu in the above screenshot. As an input for the AWS Lambda function, provide the table name as shown below.

Your function should now start running and you should see the data from your table in the logs as shown below.

Although we have just logged the data, you can use this to write your own custom functions for your own business use cases or take the data from Salesforce to any RDS database. You can use any of the other Progress DataDirect JDBC drivers to connect to Oracle Eloqua, Oracle Sales Cloud, Oracle Service Cloud, SQL Server, DB2, Mongo DB etc., from AWS Lambda. If you are using Node.js, you can use the jdbc module to connect to these data sources via DataDirect JDBC driver. Feel free to try the Progress DataDirect JDBC drivers with AWS Lambda for a hassle-free connectivity.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.