Let's get right to it, you want to run your existing code on AWS Lambda...
If you are on linux or a mac you can just run the
init.sh script in the FuseLess Template zip and it will take care of it. If you are on Windows take a look at
Currently only Lucee is supported, it may be possible to get Adobe ColdFusion running on Lambda as well, but the size of the jar files would really need to be trimmed down to fit in the 250mb code size limit. It would take a lot of experimentation to get it working, but I wouldn't say it is impossible.
The fun part... add some CFML to the
To package it up with all the jar depenedencies you will need to use download and install Gradle.
Once you have it installed from the root of the template folder run the following command in Terminal or Command Prompt:
At this point you will now have a CFML serverless application all packaged up in a zip file 🎉
The zip file is located in
build/distributions/fuseless-template.zip it can be uploaded to Lambda or tested locally using
There are two ways you can test your code - many people test directly on AWS Lambda because it is the only way to replicate the environment. You may find it more convenient to test locally however, for this you can use the AWS Sam CLI
First you will need to install
sam, follow these instructions.
sam is installed and working you can simply run the following command from your Terminal or Command Prompt:
sam local start-api
This will start a local AWS API Gateway instance on port 3000 (by default). When you make a HTTP request it will spin up an emulated Java AWS Lambda docker container on each invocation. So you take a Cold Start initialization hit on every request in this mode.
No matter what language a lambda function is written in, one of the things you will have to deal with is the cold start performance. I have found that the Cold Start time averages around 2 seconds, which is not too bad. Once the lambda is warm, it can serve many additional requests at very high performance (I've seen CFML execution times in the single digit miliseconds with FuseLess!).
Ways to minimize the Cold Start Performance hit:
Running a simple Hello World CFML can execute on lambda in as low as ~3ms.
A minimal deployment is currently around 20mb! We are working to make this even smaller.
It can work with as little as 256mb of ram but ColdStart times will be very high. Here are some possible Cold Start Request Times for different amounts of RAM
|Avg Cold Start Time
Currently FuseLess bundles Lucee Light, which does not include any extensions so tags such as
cfsearch, etc will not work unless you add the extension.
We are looking into ways to make this easy, contact Foundeo for assistance.
Lambda has several limits or constraints which are well documented. For example 15 minutes is the maximum execution time, you can only write to the
/tmp directory (tip: use
ram:// instead), 50mb zipped package size.