-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
60 lines (55 loc) · 1.56 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
service: random-recall
frameworkVersion: ">=3.38.0 <4.0.0"
custom:
credentialsProfile: heap
region: eu-west-1
secret: ${file(secrets.yml)}
provider:
name: aws
runtime: nodejs20.x
region: ${self:custom.region}
profile: ${self:custom.credentialsProfile}
iam:
role:
statements:
- Effect: Allow
Action:
- s3:ListBucket
Resource:
- !GetAtt PhotoBucket.Arn
- Effect: Allow
Action:
- s3:GetObject
Resource:
Fn::Join:
- ""
- - Fn::GetAtt: PhotoBucket.Arn
- "/photos-bot-can-send/*"
environment:
BUCKET_NAME: !Ref PhotoBucket
TELEGRAM_BOT_AUTH_TOKEN: ${self:custom.secret.telegram_bot_auth_token}
TELEGRAM_CHAT_ID: ${self:custom.secret.telegram_chat_id}
TELEGRAM_EXPECTED_CHAT_ADMIN_ID: ${self:custom.secret.telegram_expected_chat_admin_id}
TELEGRAM_EXPECTED_CHAT_ADMIN_USERNAME: ${self:custom.secret.telegram_expected_chat_admin_username}
TELEGRAM_EXPECTED_CHAT_MEMBER_COUNT: ${self:custom.secret.telegram_expected_chat_member_count}
functions:
sendPhotoToTelegram:
handler: src/index.handler
memorySize: 128
timeout: 20
events:
- schedule: cron(00 6 ? * MON,THU *)
resources:
Resources:
PhotoBucket:
Type: AWS::S3::Bucket
Properties:
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
package:
patterns:
- "!*"
- "src/*.mjs"