CIO guide to ColdFusion and AWS Cloud (Get started fast)

April 3, 2019
Host CF Alive podcast, founder CFUnited, CEO TeraTech
Wizard 34 posts
Followers: 10 people
0

CIO guide to ColdFusion and AWS Cloud (Get started fast)

Host CF Alive podcast, founder CFUnited, CEO TeraTech
Wizard 34 posts
Followers: 10 people
April 3, 2019

Moving your ColdFusion app to the cloud with AWS (Amazon Web Services) sure has its perks.

You get a faster time to market considerations, much greater scalability, and a pretty decent cost of running. Not too shabby.

But did you know about some of the cool AWS tools that you can take full advantage of using ColdFusion and CFML?

Let’s talk about some of these tools and how you can utilize ColdFusion to access them.

Using the AWS Java SDK with ColdFusion

Before you start experiencing the fun to be had in AWS, you need to first have a reliable way to access and manipulate AWS. That answer lies within the AWS Java SDK.

According to TheServerSide.com, The AWS Java SDK is

“…a collection of tools for developers creating Java-based Web apps to run on Amazon cloud components such as Amazon Simple Storage Service (S3), Amazon Elastic Compute Cloud (EC2) and Amazon SimpleDB.”

You may be wondering why you would utilize a Java suite through ColdFusion. It can be done. But just because it can, should it?

Here’s some major reasons to do so.

  1. It’s easier to work AWS via their SDK’s than through pure http requests.
  2. The Java SDK is kept up-to-date regularly.
  3. It is wholly complete and proven to be reliable and effective.

However, making use of Java libraries through CF can be a bit tricky.

The first thing you will have to do is to compile the SDK into usable JAR files. This part of the process can be very taxing. The sheer size of the file alone will test the patience of even the most stoic developers. Using a third party tool such as Ubuntu can definitely help make this process easier.

But after this… things get much easier. Now that you have a usable version of the system, you must grant permissions. Create an IAM user that allows permissions to AWS components. Brian Klaas recommends not to grant blanket permissions. And I agree. Here’s why:

The reason you don’t want to grant unrestricted access is for security reasons. Let’s just say some disgruntled employee, coworker, or hacker gets ahold of your credentials… It could cost you and your company a fortune.

In order to get the most out of your AWS experience, you need to grant permission to the following:

Once you have obtained your credentials, you can use a Basic Credentials object to connect to AWS. And then a Client Builder object to access each individual service.

AWS and Adobe ColdFusion 2018

For those of you who don’t believe Adobe is on our side… Just take a look at ColdFusion 2018. Every single day new discoveries are made about its capabilities and just how far Adobe has gone to make CF experiences delightful.

This is one of those times.

When setting up AWS services with CF2018, you don’t need to add anything other than the AWS Java SDK .jar file to your cfusion/lib directory. Nothing else.

That’s right. One JAR and you’re ready to unleash the full capabilities of AWS.

CF2016 and earlier users must still compile the following:

  • jackson-annotations-2.6.0.jar
  • jackson-core-2.6.7.jar
  • jackson-databind-2.6.7.1.jar
  • joda-time-2.8.1.jar
  • aws-java-sdk-1.11.xxx.jar

Using AWS Rekognition with CFML

The first step to use any of these tools is to connect as explained above. Now… Rekognition.

Rekognition is a machine vision tool. To simply, you know when someone tags you in a Facebook post and that little box appears around your picture automatically? That’s not necessarily a Zuckerberg spy but machine vision at work.

This can be super useful for any CIO. Aside from the super fun aspects of it, there are many different ways that this tech can be utilized including:

  • Unsafe Content Detection
    • If there are any image uploads to your web platform that are deemed unsafe or inappropriate, they will be flagged for removal.
  • Detecting and Matching Faces
    • This can be particularly useful for security purposes.
  • Text in Images
    • This feature can be exceptionally beneficial to CIOs. Use this in conjunction with other tools to create audible versions of your website for those who are visually impaired. This could be a good alternative to large font text to accommodate elderly clients or visitors.

AWS Transcribe with ColdFusion

Another awesome AWS tool that you can access via your CFML is AWS Transcribe. Once again follow the process of connecting your credentials and creating a Client Builder object to access.
(This is why that pain in the butt setup is required in the beginning. It may be a bit tedious at first, but it makes everything run smoothly.)

Transcribe may be the most useful of all the AWS tools for CIOs. This tool must have been designed with business-oriented goals and accessibility in mind.  Here are just a few things that you can use Transcribe for:

  • Creating transcriptions of audio and video files
  • Use to create subtitles for your video presentations.
    • These are great for hard of hearing folks or those just sitting in the back of the conference room.
  • Create a text searchable database of all your company’s recorded audio or video recordings.
    • This can come in handy when looking for a recorded lecture or training session.
  • Analyze data for legal, call center, or BPO operations.
    • Cover your butt. Sometimes things are said and subsequently denied. Keep your records straight with this application.

AWS Translate via Adobe ColdFusion

AWS Translate simply put is a translation service. It offers many different languages that you can translate between to make international business transactions a breeze.

This is perfect for the global CIO. And when combined with AWS Transcribe, you can create a real-time translation device. (If only, they had Wookie or Klingon available…) Conducting business with your international partners has never been easier.

One of the best parts about this service is the price. It costs $15 per one million characters. But that’s only if you exceed the two million characters given to you for free each month. A real-time translator for $15 a month is a major win for any CIO.

However, with this particular service, there are certain limitations placed on our CFML. You see, all AWS services have limits. But Translate has a very particular set of limits.

  1. 5,000 bytes of UTF-8 text in a single request
  2. 10,000 bytes per 10 seconds per language pair
  3. 20 transactions per second per language pair

If any of these limits are violated, you will trigger a service limit error. Thankfully, there is a way around it.

Loops must be created in order to not exceed the imposed limitations.

  • Instead of processing 5000 bytes, have a chunk of 4900 bytes be processed instead.
  • Loop back around to process the next chunk of 4900 bytes and so on and so forth.
  • Make sure you also take into account the 10000 bytes per 10 second rule.

Now that you’ve created your loops, you will find that words have been cut off in the middle. Don’t fret though. AWS recognizes English words as individual entities. So this problem can be easily be solved in your translate.cfm.

if (len(chunkToTranslate) GTE 4900) {

  lastWord = ListLast(chunkToTranslate, " ");

  chunkToTranslate = left(chunkToTranslate, (len(chunkToTranslate) - len(lastWord)));

  currentEndPosition -= len(lastWord);

}

Using the above “if” statement can provide a simple solution to your word truncation problem.

Adobe ColdFusion and AWS: A Perfect Pair

As you can see, it is remarkably simple to utilize many neat AWS services through the use of ColdFusion. And even easier if it’s CF2018. For those CIOs out there looking to make some neat advancements in their companies, this could definitely be worth investigating.

Related: CFML Secrets with Patrick Quinn (AWS, Lucee and SeeFusion)

Adobe CF and AWS at CF Summit East 2019

Brian Klaas talks about AWS in depth, at the conference. I suggest you go ahead and make plans to go hear what he has to say.

Learn more about Brian and his work here

CF Summit East 2019 Full Agenda and the List of Speakers

Have you ever used AWS services in your business? If so, how so and how did they work out for you?

Share your experiences in the comments below. And… If what you like what you see, you can always follow us on Twitter @CFTeraTech and make sure you don’t miss an update.

Cheers!

Originally published at www.teratech.com

Join the CF Alive revolution

Discover how we can all make CF more alive, modern and secure this year. Join other ColdFusion developers and managers in the CF Alive Inner Circle today.

  • Get early access to the CF Alive book and videos
  • Be part of a new movement for improving CF’s perception in the world.
  • Contribute to the CF Alive revolution
  • Connect with other CF developers and managers
  • There is no cost to membership.

Comments (0)
Add your comment