Update 12/12: The video is out of date since AWS released official Ruby Support. Will update it in time.

Jets supports writing simple AWS Lambda functions with Ruby. You define them in the app/functions folder. A function looks like this:


def lambda_handler(event:, context:)
  puts "hello world"

The default handler is named lambda_handler. The lambda function shows up in the Lambda console like this:

You can run the function in the AWS Lambda console and see the results:

More than Simple Functions

Though simple functions are supported by Jets, aside from the ability to use Ruby they do not really add much value. Other classes like controllers and jobs add many conveniences and are more powerful to use. Here are a few quick examples:


Controllers are designed to handle web request and serve responses.

class PostsController < ApplicationController
  def index
    # renders Lambda Proxy structure compatiable with API Gateway
    render json: {hello: "world", action: "index"}

The public methods of a Controller class get deployed as separate AWS Lambda functions.


Jobs are designed to handle background jobs and can process work outside the web request cycle. The rate declaration creates a CloudWatch rule and schedules the function to run periodically.

class HardJob < ApplicationJob
  rate "10 hours" # every 10 hours
  def dig
    puts "done digging"
    {done: "digging"}

Once again, the public methods of a Job class get deployed as separate AWS Lambda functions.

So you’d probably benefit more from writing Controllers and Jobs since they add so many conveniences over the simple function.