In this video tutorial, we’ll cover CloudWatch Event Rules and how to connect them up to AWS Lambda Functions with Ruby on Jets. We’ll explain what CloudWatch Event Rules are. Then we’ll build a Jets project from scratch with the rule_event declaration. We’ll deploy the application and test the rule event. We’ll show you how simple it is to get started with Ruby on Jets and CloudWatch Event Rules.

Example

class SecurityJob < ApplicationJob
  rule_event(
    source: ["aws.ec2"],
    detail_type: ["EC2 Instance State-change Notification"],
    detail: {
      state: ["stopping"],
    }
  )
  def instance_stopping
    puts "event #{JSON.dump(event)}" # event is available
    # logic goes here
  end
end

Hope you’ve enjoyed this article. If you find AWS Lambda, Serverless and Ruby on Jets interesting, please give it ⭐️ on GitHub. I’d appreciate it. 👍

Jets Events Series