[Looking for Charlie's main web site?]

Return of AWS Lambda support in ColdFusion 2021 Update 2...well, kinda

Note: This blog post is from 2021. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Some folks may have heard or noticed that update 2 of CF2021 has returned "CF AWS Lambda" support. And while I was delighted to hear that news, my excitement dimmed when I saw what the "returned feature" was about. (As a reminder, the feature had been removed shortly after the initial release of CF2021, in news I shared then.)

TLDR; While the original CF AWS Lambda feature (removed shortly after the release) let you CREATE AWS Lambda/serverless packages written in CFML, the feature as "returned" to us now in update 2 only allows you to CALL AWS Lambda functions from within CFML. That's QUITE a difference.

And sure, there's value in being able to call AWS LAMBDAS in cfml, as I'll note. (And yes, it's already possible to execute cfml in AWS Lambdas in Lucee via Fuseless, as I also note later.) I just am really hopeful that at some later point the original capability will be returned.

Below, I share how I came to understand things..including more on what was possible before, what we were even teased by over the summer in the prerelease of CF2021 update 2, and then finally what the current capability allows.

What the info about update 2 says, about the CF AWS Lambda feature

If you may have seen the news of update 2, whether the CF portal page announcing the update or the Adobe community forum page announcing it, they both merely mention that among the "features" of the update were "ColdFusion AWS Lambda", with a pointer to the docs page on it.

TheCF2021 update 2 technote goes just a bit further, noting that "With AWS Lambda package in ColdFusion, you can now invoke cloud based AWS Lambda functions from ColdFusion server.".

I followed the doc link when the update came out, and I could see that it was about 10 pages if printed, so I left it to check into later. Still, I started telling various folks in conversation that "the CF AWS Lambda feature has returned", or as Paul Revere might have repeated it: "the CF AWS Lambda feature has returned".

I should have read the fine print, as it were.

What the prerelease info about update 2 said about the CF AWS Lambda feature

I think I (and perhaps others) can be forgiven for not having read that "fine print": over the summer (of 2021) there was a public prerelease of CF2021 update 2., and I shared news of that prerelease back then, how it was going to include quite a few things, not least of which was a planned change to using the Azul jvm (instead of Oracle's jvm).

It so happens that the day after I shared the news, Adobe pulled the plans to change to the Azul jvm (as I noted in an update to my post then)...and the update prerelease kind of languished. Then all of a sudden we got update 2 in September.

But I still have a PDF from the update 2 prerelease where it indicated how "Serverless ColdFusion introduces support for ColdFusion as a programming language and runtime for AWS Lambda Functions", so my point is that when the update came out, I felt I was justified in spreading the news among some folks that the update had indeed "returned the CF AWS lambda feature" to us.

What the info in the docs page clarifies, about the "new"/returned CF AWS Lambda feature

Only recently did I decide to look into the new/returned feature more closely. I had a client with a need where it seemed the CF AWS Lambda feature might be a good fit, so I wanted to help him understand how it would work, so I wanted to read the docs more carefully and give it a try first. I'd been meaning to for weeks (months, even).

In their case, they wanted to run a certain part of their CFML app in an AWS Lambda package, which offered by the original feature. Some may recall that when the there was a separate cfawslambda.zip. That includes in it various things, including the "lambdazip utility ...to generate the compressed serverless bundle to be uploaded to AWS". That was offered as well in the update 2 prerelease!

So imagine my surprise when I checked out that current docs page on the feature, entitle "Get started with ColdFusion AWS Lambda". Not only was there no mention of this zip anywhere, but the opening paragraphs read:

With AWS Lambda module in ColdFusion, you can invoke AWS Lambda functions. To get started with AWS Lambda, you first create a lambda function in AWS using any supported language. You can then invoke these functions using the Lambda module in ColdFusion.

Notice: that's not discussing how to WRITE AWS Lambda/serverless functions IN CFML. No, instead, that's just about CALLING AWS Lambda/serverless functions, written in OTHER languages...those "supported" by AWS. To be clear, CFML is not one of the few languages supported by AWS for writing Lambda functions (those would be Java, Go, PowerShell, Node.js, C#, Python, and Ruby (from the FAQ answer to "Q: What languages does AWS Lambda support?".)

So again, bottom line: for now, we cannot BUILD AWS Lambda functions in CFML, as of CF2021 update 2. We can only CALL AWS lambda functions written in other languages. That's nice, but it's not the original promise. Again, here's hoping that perhaps a later version will return that.

Prologue: what to do in the meantime

Before wrapping up, I should acknowledge first that one of the real challenges of using CF-written AWS Lambdas was going to be the licensing issue. How would Adobe charge for the running of such short-lived AWS Lambda functions? I suspect it's because this problem is not yet solved that the feature was both first removed and then not in what was returned.

Consider Fuseless, for Lucee, at least

Finally, if you ARE really wanting to write CFML lambda functions, note that Pete Freitag of Foundeo has created an implementation of it using Lucee (the alternative open-source CFML engine), called fuseless. Being open source (that tool and the CFML engine), there are no licensing concerns. You would just pay what Amazon charges for running Lambdas, which many would consider to be quite inexpensive, for most use cases (and includes a million free calls in the AWS Free Tier).

Even if you may not want to rewrite your entire app to run in Lucee, you may get great value from encapsulating some specific functionality to run as an AWS Lambda using Fuseless. Or if nothing else, you can use it to dip your tow in the water regarding both AWS Lambda functions and Lucee.

Indeed, many would hope that Adobe may find a way to offer the ability to run AWS Lambdas in CFML, for those who have been looking forward to that or who may want to consider it in the future.

P.S.: You may notice I've been careful to always refer to AWS Lambda (lower-case "L") rather than just lambda . That's not due to legal/copyright reasons. It's that CF does indeed have support lambda for (lower-case "l", not AWS) functions already, Also known as "fat arrow" functions, those were added in CF2018 update 5 (and are in CF2021 and above, of course). For more, see the section, "Lambdas - What are they?" in the CF docs page on closures.

For more content like this from Charlie Arehart: Need more help with problems?
  • If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
  • See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting