Yep, exactly. We're currently running the exact same code on both AWS Lambda and IronWorker, all that differs is a simple handler file.
We're looking to add support for Microsoft's new Azure Functions and Google Cloud Functions, and this will be a matter of creating a single file for each to handle the input.
You should always abstract your dependencies, especially if it's a critical part of your infrastructure.