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

app/functions/simple.rb:

def handle(event, context)
  puts "hello world"
end

This is what AWS Lambda Ruby support would likely look like. The default handler is named handle. 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

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"}
  end

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

Jobs

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"}
  end
end

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.