AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Auto-transcriber and sentiment analyzer Parameters: InputBucketName: Type: String Default: 'myTranscribeBucket' Globals: Function: Timeout: 10 Resources: InputS3Bucket: Type: AWS::S3::Bucket Properties: BucketName: !Ref InputBucketName ResultsDDBtable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - AttributeName: partitionKey AttributeType: S KeySchema: - AttributeName: partitionKey KeyType: HASH BillingMode: PAY_PER_REQUEST SentimentFunction: Type: AWS::Serverless::Function Properties: CodeUri: sentimentFunction/ Handler: app.handler Runtime: nodejs12.x MemorySize: 128 Environment: Variables: ddbTable: !Ref ResultsDDBtable Policies: - DynamoDBCrudPolicy: TableName: !Ref ResultsDDBtable - S3CrudPolicy: BucketName: !Ref InputBucketName - Statement: - Sid: comprehendDetectSentimentPolicy Effect: Allow Action: - comprehend:DetectSentiment Resource: '*' Events: FileUpload: Type: S3 Properties: Bucket: !Ref InputS3Bucket Events: s3:ObjectCreated:* Filter: S3Key: Rules: - Name: suffix Value: '.json' TranslatorFunction: Type: AWS::Serverless::Function Properties: CodeUri: transcribeFunction/ Handler: app.handler Runtime: nodejs12.x MemorySize: 128 Policies: - S3CrudPolicy: BucketName: !Ref InputBucketName - Statement: - Effect: Allow Resource: '*' Action: - transcribe:StartTranscriptionJob - cloudwatch:GetMetricStatistics - cloudwatch:ListMetrics Events: FileUpload: Type: S3 Properties: Bucket: !Ref InputS3Bucket Events: s3:ObjectCreated:* Filter: S3Key: Rules: - Name: suffix Value: '.mp3'