Mercurial > public > finance-parser
diff template.yaml @ 2:ef8a4d95755a
add aws sam project
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Thu, 01 Jun 2023 18:51:18 +0100 |
parents | |
children | 2e5f3664f3e4 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template.yaml Thu Jun 01 18:51:18 2023 +0100 @@ -0,0 +1,55 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Serverless balance sheet analyzer using Textract and a serverless API + +Conditions: + CreateProdResources: !Equals + - !Ref AWS::AccountId + - 572540046516 # Dennis account ID (Production) + +Globals: + Function: + Runtime: python3.7 + Handler: app.lambda_handler + Architectures: + - x86_64 + Timeout: 20 + MemorySize: 256 + Tracing: Active + +Resources: + S3Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: !If + - CreateProdResources + - finance-parser-data + - sandbox-finance-parser-data + + ProcessDocumentFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: process_document/ + Handler: app.lambda_handler + Runtime: python3.7 + Policies: + - Version: "2012-10-17" + Statement: + - Effect: Allow + Action: + - textract:AnalyzeDocument + Resource: "*" + Events: + NewBalanceSheetEvent: + Type: S3 + Properties: + Bucket: !Ref S3Bucket + Events: s3:ObjectCreated:* + Connectors: + S3Connector: + Properties: + Destination: + Id: S3Bucket + Permissions: + - Read + - Write \ No newline at end of file