Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Lambda to process the data stream from Kinesis in real time
require 'json'
require 'base64'
require 'aws-sdk-s3'
def lambda_handler(event:, context:)
region = ''
bucket_name = ''
access_key = ''
secret_key = ''
resource = region, credentials:, secret_key))
bucket = resource.bucket(bucket_name)
key = "projectbuddy/vehicle"
puts "event['Records'] = #{event['Records'].size}"
event['Records']&.each do |record|
puts "record['kinesis']['data'] = #{record['kinesis']['data']}"
payload = Base64.decode64(record['kinesis']['data'])
puts "Decoded payload: #{payload}"
bucket.put_object(key: "#{key}/#{}", body: payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.