paul@home:~$

Interesting and Technical problems solved and explained

Compiling Fuseless in Cloud 9 for Coldfusion/CFML in AWS Lambda

Function

In the previous article on CFML I provided a very high level overview of CFML in Lambda. In this post I will show how easy it is to:

  • Install a JDK on Cloud9
  • Install gradle for java projects
  • Compile Fuseless from source
  • Deploy a CFML mini app to AWS Lamba

The video provided shows that in 7 minutes I was able to, from a completely fresh environment, deploy a PoC CFML lambda app.

Every step executed is listed below with some commentary.

# Install Corretto ( java 1.8 ) - https://aws.amazon.com/corretto this is the jdk required to compile Fuseless
sudo yum install -y https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.rpm

Function


# Download gradle and unzip it to /opt/gradle
wget https://services.gradle.org/distributions/gradle-6.5-bin.zip -P /tmp

sudo unzip -d /opt/gradle /tmp/gradle-6.5-bin.zip

# Set 2 ENV variables to add gradle to the path 
export GRADLE_HOME=/opt/gradle/gradle-6.5
export PATH=${GRADLE_HOME}/bin:${PATH}

# Ensure the ENV variables persist in a new terminal session
cat >> ~/.bash_profile  <<TXT
export GRADLE_HOME=${GRADLE_HOME}
export PATH=${GRADLE_HOME}/bin:${PATH}
TXT

Function

Open a new terminal ( Java home won’t be set after the corretto install until you set it or open a new terminal ).

# Check if java is available for use
java -version
# Check if gradle is available for use
gradle -v

Function

Clone and build Fuseless

git clone https://github.com/foundeo/fuseless.git

cd fuseless

# Run the test shell script, this will build the package, download lucee light and run some tests.
./test.sh

Function

Look for the passing tests:

Function

Deployment

# Deploy section, clone the fuseless-template repo, there is an open PR to include the out outputs of the API endpoint 
# for now the repo is a fork of fuseless-template
cd ..

git clone https://github.com/kukielp/fuseless-template.git

cd fuseless-template

# This shell script will download the fuseless jar and lucee light plus 
./init.sh

# This will package up/zip the cfml and jars required
gradle build

Function

# Guideded process to deploy.
sam deploy --guided

Function

Function

Function

Open the URL, be sure to append the template in this example it’s dump.cfm

Function

Full video:

If you are not sure what Cloud 9 is it’s basically a Virtual machine with a web based IDE. I am running Amazon Linux. You can read more about it here: https://aws.amazon.com/cloud9/