Skip to content

Instantly share code, notes, and snippets.

@mbklein
Created May 22, 2019 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbklein/4f097dc2133ddea73d040d33394fe6b4 to your computer and use it in GitHub Desktop.
Save mbklein/4f097dc2133ddea73d040d33394fe6b4 to your computer and use it in GitHub Desktop.
Ruby Lambda
require 'aws-sdk-ecs'
require 'aws-sdk-sqs'
require 'json'
def handle_event(event:, context:)
handler = LambdaHandler.new(event, context)
handler.process!
end
class LambdaHandler
attr_reader :event, :context
def initialize(event, context)
@event = event
@context = context
end
# Do whatever the Lambda should do
#
# @attr event is a hash passed in by the caller. (It's how
# Lambda functions receive arguments.)
# @attr context contains info about the Lambda and environment,
# and is documented at:
# https://docs.aws.amazon.com/lambda/latest/dg/ruby-context.html
# @return [status, message, body]
# (e.g., [201, 'Created', '']
def process!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment