CloudWatch Event Rules and AWS Lambda with Ruby on Jets
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
- Ruby on Jets CloudWatchEvent Rules Docs
- The full source code is available on GitHub: tongueroo/jets-cloudwatch-event-example
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
Thanks for reading this far. If you found this article useful, I'd really appreciate it if you share this article so others can find it too! Thanks 😁 Also follow me on Twitter.
Got questions? Check out BoltOps.
You might also like
More tools:
-
Kubes
Kubes: Kubernetes Deployment Tool
Kubes is a Kubernetes Deployment Tool. It builds the docker image, creates the Kubernetes YAML, and runs kubectl apply. It automates the deployment process and saves you precious finger-typing energy.
-
Jets
Jets: The Ruby Serverless Framework
Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.
-
Lono
Lono: The CloudFormation Framework
Building infrastructure-as-code is challenging. Lono makes it much easier and fun. It includes everything you need to manage and deploy infrastructure-as-code.