-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
67 lines (60 loc) · 1.62 KB
/
serverless.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
62
63
64
65
66
67
service: demo-link-shortener
provider:
name: aws
region: eu-west-3
runtime: provided.al2
deploymentMethod: direct # fastest deployment method
iam:
role:
statements:
- Effect: Allow
Action: events:PutEvents
Resource: '*'
plugins:
- serverless-lift
- ./vendor/bref/bref
functions:
entrypoint:
handler: entrypoint.php
description: 'API to register one or more links'
environment:
TABLE_NAME: ${construct:links.tableName}
DOMAIN_NAME: 'https://link.test'
layers:
- ${bref:layer.php-81}
events:
- httpApi:
method: 'POST'
path: '/links'
update-short-links:
handler: update-short-links.php
description: 'Update the list of redirected short links'
layers:
- ${bref:layer.php-81}
environment:
BUCKET_NAME: ${construct:published-links.bucketName}
reservedConcurrency: 1
events:
- eventBridge:
pattern:
detail-type: ['LinkWasRegistered']
redirect:
handler: index.php
description: 'Redirect user to target URL'
layers:
- ${bref:layer.php-81}
environment:
BUCKET_NAME: ${construct:published-links.bucketName}
events:
- httpApi:
method: 'GET'
path: '/{id+}'
constructs:
published-links:
type: storage
links:
type: database/dynamodb-single-table
# Exclude files from deployment
package:
patterns:
- '!tests/**'