forked from OWASP/Serverless-Goat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
57 lines (55 loc) · 1.44 KB
/
template.yaml
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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Runtime: nodejs10.x
Handler: index.handler
MemorySize: 3008
Timeout: 10
Resources:
FunctionFrontend:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/frontend/
ReservedConcurrentExecutions: 5
Events:
ApiConvert:
Type: Api
Properties:
Path: /
Method: get
FunctionConvert:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/api/convert/
ReservedConcurrentExecutions: 5
Environment:
Variables:
HOME: /var/task
TABLE_NAME: !Ref Table
BUCKET_NAME: !Ref Bucket
BUCKET_URL: !GetAtt Bucket.WebsiteURL
Events:
ApiConvert:
Type: Api
Properties:
Path: /api/convert
Method: get
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref Table
- S3FullAccessPolicy:
BucketName: !Ref Bucket
Table:
Type: AWS::Serverless::SimpleTable
Bucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: index.html
Outputs:
WebsiteURL:
Description: 'Website URL'
Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/${ServerlessRestApi.Stage}/'