-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
111 lines (105 loc) · 3.26 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
service: 'self-hosted-link-crawler'
custom:
site-name: FILL
bucket-name: FILL
hostedZoneName: FILL
aliasHostedZoneId: Z3AQBSTGFYJSTF # us-east-1
aliasDNSName: s3-website-us-east-1.amazonaws.com
provider:
name: aws
timeout: 120
stackName: 'self-hosted-link-crawler'
runtime: nodejs12.x
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: "*"
- Effect: Allow
Action:
- s3:PutObject
- s3:PutObjectAcl
Resource: "arn:aws:s3:::${self:custom.bucket-name}/*"
package:
individually: true
exclude:
- node_modules/**/aws-sdk/**
- node_modules/**/node/**
- node_modules/**/node-bin-setup/**
- test/**
- coverage/**
- .vscode/**
- README.md
- LICENSE
functions:
link-crawler:
handler: src/linkScrapperHandler.handler
name: link-crawler
package:
exclude:
- src/staticPageHandler.js
- src/contentDistribution/**
events:
- schedule: cron(0 12 * * ? *)
page-builder:
handler: src/staticPageHandler.handler
name: page-builder
environment:
BUCKET_NAME: ${self:custom.bucket-name}
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
- s3:PutObjectAcl
Resource: "arn:aws:s3:::${self:custom.bucket-name}/*"
package:
exclude:
- src/linkScrapperHandler.js
- src/dataManipulation/**
resources:
Resources:
StaticWebpage:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.bucket-name}
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
StaticWebpageS3BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: StaticWebpage
PolicyDocument:
Id: WebPagePolicyDocument
Version: "2012-10-17"
Statement:
- Sid: PublicReadGetObject
Effect: Allow
Principal: "*"
Action:
- s3:GetObject
Resource:
Fn::Join: [
"", [
"arn:aws:s3:::",
{
"Ref": "StaticWebpage"
},
"/*"
]
]
R53HostedZone:
Type: AWS::Route53::HostedZone
Properties:
Name: FILL
DnsRecord:
Type: "AWS::Route53::RecordSet"
Properties:
AliasTarget:
DNSName: ${self:custom.aliasDNSName}
HostedZoneId: ${self:custom.aliasHostedZoneId}
HostedZoneName: ${self:custom.site-name}.
Name:
Ref: StaticWebpage
Type: 'A'