├── slides └── MLH Fellowship Show & Tell.pdf ├── README.md ├── insertdata.py ├── getdata.py ├── LICENSE └── tests ├── getdatatest.txt └── insertdatatest.txt /slides/MLH Fellowship Show & Tell.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksdkamesh99/MLH-Show-and-Tell/main/slides/MLH Fellowship Show & Tell.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MLH Show and Tell 2 | 3 | ## Topic:- AWS Serverless Services 4 | 5 | ## Link to the Video:- https://drive.google.com/file/d/1qnEsPtE7mhLVY9LJoiy-5Eqt1b0KkBhD/view?usp=sharing 6 | 7 | ## Concepts Covered in the Show and Tell:- 8 | 1. AWS Lambda 9 | 2. AWS DynamoDB 10 | 3. AWS API Gateway 11 | 4. AWS Serverless Overview 12 | -------------------------------------------------------------------------------- /insertdata.py: -------------------------------------------------------------------------------- 1 | import boto3 2 | import json 3 | 4 | 5 | dynamo_client = boto3.resource('dynamodb') 6 | table = dynamo_client.Table('Students') 7 | 8 | def lambda_handler(event, context): 9 | unique_id=str(event["queryStringParameters"]["id"]) 10 | firstname=str(event["queryStringParameters"]["fname"]) 11 | lastname=str(event["queryStringParameters"]["lname"]) 12 | techstack=str(event["queryStringParameters"]["techstack"]) 13 | item={} 14 | item["id"]=unique_id 15 | item["firstname"]=firstname 16 | item["lastname"]=lastname 17 | item["techstack"]=techstack 18 | table.put_item(Item=item) 19 | return { 20 | 'statusCode': 200, 21 | 'body': json.dumps('Data Stored Successfully') 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /getdata.py: -------------------------------------------------------------------------------- 1 | import boto3 2 | import json 3 | 4 | dynamo_client = boto3.resource('dynamodb') 5 | table = dynamo_client.Table('Students') 6 | 7 | def lambda_handler(event, context): 8 | unique_id=str(event['queryStringParameters']['id']) 9 | key={ 10 | 'id':unique_id 11 | } 12 | 13 | response_table=table.get_item(Key=key) 14 | 15 | item=response_table['Item'] 16 | print(item) 17 | output_response={} 18 | output_response["id"]=str(item["id"]) 19 | output_response["firstname"]=item["firstname"] 20 | output_response["lastname"]=item["lastname"] 21 | output_response["techstack"]=item["techstack"] 22 | 23 | responseObject = {} 24 | responseObject['statusCode'] = 200 25 | responseObject['headers'] = {} 26 | responseObject['headers']['Content-Type'] = 'application/json' 27 | responseObject['body'] = json.dumps(output_response) 28 | return responseObject 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sai Durga Kamesh Kota 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/getdatatest.txt: -------------------------------------------------------------------------------- 1 | { 2 | "body": "eyJ0ZXN0IjoiYm9keSJ9", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": true, 7 | "queryStringParameters": { 8 | "id": 1 9 | }, 10 | "multiValueQueryStringParameters": { 11 | "foo": [ 12 | "bar" 13 | ] 14 | }, 15 | "pathParameters": { 16 | "proxy": "/path/to/resource" 17 | }, 18 | "stageVariables": { 19 | "baz": "qux" 20 | }, 21 | "headers": { 22 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 23 | "Accept-Encoding": "gzip, deflate, sdch", 24 | "Accept-Language": "en-US,en;q=0.8", 25 | "Cache-Control": "max-age=0", 26 | "CloudFront-Forwarded-Proto": "https", 27 | "CloudFront-Is-Desktop-Viewer": "true", 28 | "CloudFront-Is-Mobile-Viewer": "false", 29 | "CloudFront-Is-SmartTV-Viewer": "false", 30 | "CloudFront-Is-Tablet-Viewer": "false", 31 | "CloudFront-Viewer-Country": "US", 32 | "Host": "1234567890.execute-api.us-east-2.amazonaws.com", 33 | "Upgrade-Insecure-Requests": "1", 34 | "User-Agent": "Custom User Agent String", 35 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 36 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 37 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 38 | "X-Forwarded-Port": "443", 39 | "X-Forwarded-Proto": "https" 40 | }, 41 | "multiValueHeaders": { 42 | "Accept": [ 43 | "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" 44 | ], 45 | "Accept-Encoding": [ 46 | "gzip, deflate, sdch" 47 | ], 48 | "Accept-Language": [ 49 | "en-US,en;q=0.8" 50 | ], 51 | "Cache-Control": [ 52 | "max-age=0" 53 | ], 54 | "CloudFront-Forwarded-Proto": [ 55 | "https" 56 | ], 57 | "CloudFront-Is-Desktop-Viewer": [ 58 | "true" 59 | ], 60 | "CloudFront-Is-Mobile-Viewer": [ 61 | "false" 62 | ], 63 | "CloudFront-Is-SmartTV-Viewer": [ 64 | "false" 65 | ], 66 | "CloudFront-Is-Tablet-Viewer": [ 67 | "false" 68 | ], 69 | "CloudFront-Viewer-Country": [ 70 | "US" 71 | ], 72 | "Host": [ 73 | "0123456789.execute-api.us-east-2.amazonaws.com" 74 | ], 75 | "Upgrade-Insecure-Requests": [ 76 | "1" 77 | ], 78 | "User-Agent": [ 79 | "Custom User Agent String" 80 | ], 81 | "Via": [ 82 | "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)" 83 | ], 84 | "X-Amz-Cf-Id": [ 85 | "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==" 86 | ], 87 | "X-Forwarded-For": [ 88 | "127.0.0.1, 127.0.0.2" 89 | ], 90 | "X-Forwarded-Port": [ 91 | "443" 92 | ], 93 | "X-Forwarded-Proto": [ 94 | "https" 95 | ] 96 | }, 97 | "requestContext": { 98 | "accountId": "123456789012", 99 | "resourceId": "123456", 100 | "stage": "prod", 101 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 102 | "requestTime": "09/Apr/2015:12:34:56 +0000", 103 | "requestTimeEpoch": 1428582896000, 104 | "identity": { 105 | "cognitoIdentityPoolId": null, 106 | "accountId": null, 107 | "cognitoIdentityId": null, 108 | "caller": null, 109 | "accessKey": null, 110 | "sourceIp": "127.0.0.1", 111 | "cognitoAuthenticationType": null, 112 | "cognitoAuthenticationProvider": null, 113 | "userArn": null, 114 | "userAgent": "Custom User Agent String", 115 | "user": null 116 | }, 117 | "path": "/prod/path/to/resource", 118 | "resourcePath": "/{proxy+}", 119 | "httpMethod": "POST", 120 | "apiId": "1234567890", 121 | "protocol": "HTTP/1.1" 122 | } 123 | } -------------------------------------------------------------------------------- /tests/insertdatatest.txt: -------------------------------------------------------------------------------- 1 | { 2 | "body": "eyJ0ZXN0IjoiYm9keSJ9", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": true, 7 | "queryStringParameters": { 8 | "id": 1, 9 | "fname": "kamesh", 10 | "lname": "kota", 11 | "techstack": "data science" 12 | }, 13 | "multiValueQueryStringParameters": { 14 | "foo": [ 15 | "bar" 16 | ] 17 | }, 18 | "pathParameters": { 19 | "proxy": "/path/to/resource" 20 | }, 21 | "stageVariables": { 22 | "baz": "qux" 23 | }, 24 | "headers": { 25 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 26 | "Accept-Encoding": "gzip, deflate, sdch", 27 | "Accept-Language": "en-US,en;q=0.8", 28 | "Cache-Control": "max-age=0", 29 | "CloudFront-Forwarded-Proto": "https", 30 | "CloudFront-Is-Desktop-Viewer": "true", 31 | "CloudFront-Is-Mobile-Viewer": "false", 32 | "CloudFront-Is-SmartTV-Viewer": "false", 33 | "CloudFront-Is-Tablet-Viewer": "false", 34 | "CloudFront-Viewer-Country": "US", 35 | "Host": "1234567890.execute-api.us-east-2.amazonaws.com", 36 | "Upgrade-Insecure-Requests": "1", 37 | "User-Agent": "Custom User Agent String", 38 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 39 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 40 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 41 | "X-Forwarded-Port": "443", 42 | "X-Forwarded-Proto": "https" 43 | }, 44 | "multiValueHeaders": { 45 | "Accept": [ 46 | "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" 47 | ], 48 | "Accept-Encoding": [ 49 | "gzip, deflate, sdch" 50 | ], 51 | "Accept-Language": [ 52 | "en-US,en;q=0.8" 53 | ], 54 | "Cache-Control": [ 55 | "max-age=0" 56 | ], 57 | "CloudFront-Forwarded-Proto": [ 58 | "https" 59 | ], 60 | "CloudFront-Is-Desktop-Viewer": [ 61 | "true" 62 | ], 63 | "CloudFront-Is-Mobile-Viewer": [ 64 | "false" 65 | ], 66 | "CloudFront-Is-SmartTV-Viewer": [ 67 | "false" 68 | ], 69 | "CloudFront-Is-Tablet-Viewer": [ 70 | "false" 71 | ], 72 | "CloudFront-Viewer-Country": [ 73 | "US" 74 | ], 75 | "Host": [ 76 | "0123456789.execute-api.us-east-2.amazonaws.com" 77 | ], 78 | "Upgrade-Insecure-Requests": [ 79 | "1" 80 | ], 81 | "User-Agent": [ 82 | "Custom User Agent String" 83 | ], 84 | "Via": [ 85 | "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)" 86 | ], 87 | "X-Amz-Cf-Id": [ 88 | "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==" 89 | ], 90 | "X-Forwarded-For": [ 91 | "127.0.0.1, 127.0.0.2" 92 | ], 93 | "X-Forwarded-Port": [ 94 | "443" 95 | ], 96 | "X-Forwarded-Proto": [ 97 | "https" 98 | ] 99 | }, 100 | "requestContext": { 101 | "accountId": "123456789012", 102 | "resourceId": "123456", 103 | "stage": "prod", 104 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 105 | "requestTime": "09/Apr/2015:12:34:56 +0000", 106 | "requestTimeEpoch": 1428582896000, 107 | "identity": { 108 | "cognitoIdentityPoolId": null, 109 | "accountId": null, 110 | "cognitoIdentityId": null, 111 | "caller": null, 112 | "accessKey": null, 113 | "sourceIp": "127.0.0.1", 114 | "cognitoAuthenticationType": null, 115 | "cognitoAuthenticationProvider": null, 116 | "userArn": null, 117 | "userAgent": "Custom User Agent String", 118 | "user": null 119 | }, 120 | "path": "/prod/path/to/resource", 121 | "resourcePath": "/{proxy+}", 122 | "httpMethod": "POST", 123 | "apiId": "1234567890", 124 | "protocol": "HTTP/1.1" 125 | } 126 | } --------------------------------------------------------------------------------