Skip to content

Instantly share code, notes, and snippets.

View SrushithR's full-sized avatar

Srushith Repakula SrushithR

View GitHub Profile
@SrushithR
SrushithR / s3_select.py
Created May 11, 2019 15:52
Sample code to stream data from a JSON file in S3 using S3 select
"""
A sample funtion to perform S3 select operation on a JSON file stored in S3 bucket
The bucket and file names are stored as environment variables
"""
import os
import boto3
def get_data():
"""
Using S3 select to query data from S3
@SrushithR
SrushithR / pdf_generation.py
Created April 4, 2019 13:43
A simple lambda function to mimic behaviour of a PDF generation for a movie ticketing application
"""
A simple lambda function to mimic the behaviour of PDF generation
"""
import time
def lambda_handler(event, context):
# mocking the behavior of generating a PDF
time.sleep(2)
return "PDF successfully generated"
@SrushithR
SrushithR / ticket_booking.py
Created April 4, 2019 13:17
Simple lambda function to emulate a ticket generation process. This lambda function connects to an S3 bucket, gets the credentials file and then a second lambda function to generate the PDF and update the database
"""
Lambda function to mimic the process of a movie ticket generation
"""
import boto3
import requests
# just add these lines for active tracing of the data flow
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all