Extend Salesforce with AWS Lambda

Salesforce developers can use Apex to develop many powerful solutions on-platform.  However, Apex does not have native tools to handle scenarios that involve large file conversion, FTP connections, and other non-native functionality.  Enter AWS Serverless Functions, aka AWS Lambda.

Apex: Powerful Native Functionality

Apex is Salesforce’s server-side programming framework. With Apex you can operate on the business logic within your salesforce instance.  Apex is similar to Java syntax and is a great solution for data manipulation, batch processing, and API callouts from within a Salesforce instance.

But Apex isn’t the right tool for every job.  One distinct shortfall of the Apex programming language is the lack of native file conversion support.  For example, if given an Excel file (.xslx), there is no native functionality to convert to .csv format.  Another limitation is the lack of File Transfer Protocol (FTP) access.  Salesforce integration occurs only via HTTPS. 

Taken together these two limitations mean that when you need to pick up files from a remote server and apply a format conversion, there is no all-encompassing way to do this in pure Apex.

Python: Limitless Expandability

Python is a powerful and flexible language that has none of the limitations mentioned above.  It’s rapidly becoming the leading programming language, and can be written within VS Code, just like Apex.

Python is also highly extendable.  Open source software libraries can be imported in Python, adding file conversion, big data, GIS, pdf text recognition, and other capabilities.  The potential capabilities are huge, but Python does have one weakness within the Salesforce ecosystem: Python does not run natively within your Salesforce org.

AWS Lambda to the Rescue

So how can we leverage the power of both Apex and Python?  Enter AWS Lambda.  Lambda is a serverless function technology offered by AWS.  It allows code to run in a serverless environment, without the need to provision servers, manage memory, etc.

Lambda can host most popular programming languages: Python, Node, C#, and others.  Lambda also has a bevy of customizable parameters and functions that allow for very customizable solutions when working with Salesforce.

Lastly, AWS Lambda has a free tier that includes 1M requests per month (at the time of this writing).  That’s more than enough for a proof of concept project, or even moderate production use.  We have clients that move thousands of records per day using the AWS Lambda free tier.

Use Case: Converting Flat Files into Salesforce Data

Flat data files and on-premises FTP servers are still in use within many corporate enterprises.  Sometimes the enterprise’s clients refuse to update their existing flat file integrations, even as data volume becomes massive.  Soon .csv files with hundreds of thousands of rows are being imported every day.

It’s inevitable that the above enterprises will be pushed toward digital transformation and cloud centric infrastructure in the future.  But tools like AWS lambda can help provide a bridge between the future and current state. In short: a legacy flat data file goes into one side, and normalized data is inserted into Salesforce on the other end.

Salesforce and AWS: a Match Made in Heaven

Our AWS-certified consultants often see clients who want to “break out” of standard Salesforce functionality via AWS.  Salesforce may be a client’s system of record, but often clients who add serverless capabilities via AWS Lambda will add other AWS abilities.  For example:

  • AWS Aurora + Quicksight as a data warehouse and business intelligence tool.
  • AWS Cloudwatch for scheduling batching, monitoring, and alerting
  • AWS S3 for file storage and long-term archiving

Future Functionality

Serverless is a very popular trend these days.   Salesforce is currently piloting Evergreen, their fully-managed serverless functions add-on.  But the release date is unknown.  And it will be tough to compete with the AWS Lambda free tier, which offers one million free requests per month.


Serverless functions, especially AWS Lambda, can be an excellent way to extend Salesforce without significant infrastructure investment.  Python can easily be tied into your existing Salesforce instance and provide you a wealth of options for functionality that is not native in Apex.

Interested in bridging the gap between Salesforce and AWS?  Contact us for a free consultation.