This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import boto3 | |
| import os | |
| dynamodb = boto3.client('dynamodb') | |
| def handle(event, context): | |
| connectionId = event['requestContext']['connectionId'] | |
| # Insert the connectionId of the connected device to the database |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| import json | |
| from boto3.dynamodb.conditions import Key, Attr | |
| def lambda_handler(event, context): | |
| eventBody = json.loads(json.dumps(event))['body'] | |
| searchString = json.loads(eventBody)['Search'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import boto3 | |
| import os | |
| def getJobResults(jobId): | |
| pages = [] | |
| textract = boto3.client('textract') | |
| response = textract.get_document_text_detection(JobId=jobId) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import urllib.parse | |
| import boto3 | |
| import os | |
| def handle(event, context): | |
| print("Triggered getTextFromS3PDF event: " + json.dumps(event, indent=2)) | |
| # Get the object from the event and show its content type | |
| bucket = event['Records'][0]['s3']['bucket']['name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service: textract-ocr-service | |
| custom: | |
| currentStage: ${opt:stage, self:provider.stage} | |
| s3BucketName: textractbucket-#{AWS::AccountId}-${self:custom.currentStage} | |
| snsTopicName: pdfExtractionDone-#{AWS::AccountId}-${self:custom.currentStage} | |
| snsFullAccessRoleName: AwsSnsFullAccessRole-#{AWS::AccountId}-${self:custom.currentStage} | |
| lambdaRunTime: python3.7 | |
| provider: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resources: | |
| Resources: | |
| snsAccessRole: | |
| Type: AWS::IAM::Role | |
| Properties: | |
| RoleName: ${self:custom.snsFullAccessRoleName} | |
| ManagedPolicyArns: | |
| - arn:aws:iam::aws:policy/AmazonSNSFullAccess | |
| AssumeRolePolicyDocument: | |
| Statement: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| functions: | |
| pdfgetjobresult: | |
| handler: pdf_extract_result.handle | |
| layers: | |
| - { Ref: Boto3LayerLambdaLayer } | |
| events: | |
| - sns: | |
| topicName: ${self:custom.snsTopicName} | |
| displayName: Pdf Extraction Done SNS | |
| pdfextractstart: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| layers: | |
| boto3Layer: | |
| path: lib/boto3 | |
| name: boto3-layer | |
| description: Boto3 layer for stage | |
| compatibleRuntimes: | |
| - ${self:custom.lambdaRunTime} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins: | |
| - serverless-pseudo-parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| provider: | |
| name: aws | |
| iamManagedPolicies: | |
| - arn:aws:iam::aws:policy/AmazonSNSFullAccess | |
| - arn:aws:iam::aws:policy/AmazonTextractFullAccess | |
| - arn:aws:iam::aws:policy/AmazonS3FullAccess | |
| runtime: ${self:custom.lambdaRunTime} | |
| versionFunctions: false | |
| region: us-east-1 |