-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtemplate.yml
61 lines (60 loc) · 1.7 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: A serverless component for transcribing from MP3, MP4, WAV, FLAC to Text
Parameters:
LanguageCode:
Type: String
Description: 'The language code of your audio file'
AllowedValues : ['en-US','es-US','en-AU','fr-CA','en-GB','de-DE','pt-BR','fr-FR','it-IT','ko-KR','es-ES']
InputS3BucketName:
Type: String
Default: 's3-lambda-transcribe-input-audio-bucket'
MinLength: 3
OutputS3BucketName:
Type: String
Default: 's3-lambda-transcribe-output-text-bucket'
MinLength: 3
Resources:
InputS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref InputS3BucketName
ConvertFileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Timeout: 30
MemorySize: 1024
Runtime: nodejs12.x
CodeUri: src/
Policies:
- S3CrudPolicy:
BucketName: !Ref OutputS3BucketName
- S3ReadPolicy:
BucketName: !Ref InputS3BucketName
- Statement:
- Effect: Allow
Action:
- 'transcribe:StartTranscriptionJob'
Resource: '*'
Environment:
Variables:
OUTPUT_BUCKET: !Ref OutputS3Bucket
LANGUAGE_CODE: !Ref LanguageCode
Events:
FileUpload:
Type: S3
Properties:
Bucket: !Ref InputS3Bucket
Events: s3:ObjectCreated:*
OutputS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref OutputS3BucketName
Outputs:
InputS3Bucket:
Description: Input S3 bucket
Value: !Ref InputS3Bucket
OutputS3Bucket:
Description: Output S3 bucket
Value: !Ref OutputS3Bucket