-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtemplate.yaml
More file actions
37 lines (35 loc) · 1.25 KB
/
template.yaml
File metadata and controls
37 lines (35 loc) · 1.25 KB
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An example application that translates text file contents.
Resources:
TranslateFileFunction:
Type: 'AWS::Serverless::Function'
Properties:
FunctionName: TranslateFile
Handler: app.lambda_handler
Runtime: python3.7
CodeUri: src/translate_file
Description: A Lambda function that translates text file contents.
Timeout: 120
Policies:
- S3ReadPolicy:
# Need to specify bucket name to avoid a circular dependency
# More details: https://aws.amazon.com/blogs/infrastructure-and-automation/handling-circular-dependency-errors-in-aws-cloudformation/
BucketName: !Sub "translate-file-bucket-${AWS::AccountId}"
- Statement:
- Sid: TranslateText
Effect: Allow
Action:
- translate:TranslateText
- comprehend:DetectDominantLanguage
Resource: '*'
Events:
FileUploadedEvent:
Type: S3
Properties:
Bucket: !Ref FileBucket
Events: s3:ObjectCreated:*
FileBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "translate-file-bucket-${AWS::AccountId}"