-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
151 lines (145 loc) · 3.6 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
service: seoul-demo-reminder
useDotenv: true
provider:
name: aws
runtime: nodejs18.x
region: ap-northeast-2
stage: ${opt:stage, 'dev'}
environment:
IS_LOCAL: ${env:IS_LOCAL}
SQS_AWS_REGION: ${env:SQS_AWS_REGION}
SEND_EMAIL_SQS_URL: ${env:SEND_EMAIL_SQS_URL}
SEND_EMAIL_SQS_ARN: ${env:SEND_EMAIL_SQS_ARN}
DIVIDE_EMAIL_SQS_URL: ${env:DIVIDE_EMAIL_SQS_URL}
DIVIDE_EMAIL_SQS_ARN: ${env:DIVIDE_EMAIL_SQS_ARN}
EMAIL_SENDER_ADDRESS: ${env:EMAIL_SENDER_ADDRESS}
EMAIL_SENDER_PASSWORD: ${env:EMAIL_SENDER_PASSWORD}
iamRoleStatements:
- Effect: Allow
Action:
- cloudformation:Describe*
- cloudformation:List*
- cloudformation:Get*
- cloudformation:CreateStack
- cloudformation:UpdateStack
- cloudformation:DeleteStack
- cloudformation:CreateChangeSet
- cloudformation:ExecuteChangeSet
- cloudformation:DeleteChangeSet
- cloudformation:ValidateTemplate
Resource: '*'
- Effect: Allow
Action:
- lambda:*
Resource: '*'
- Effect: Allow
Action:
- s3:CreateBucket
- s3:ListBucket
- s3:GetBucketLocation
- s3:DeleteBucket
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
# @see https://github.com/serverless/serverless/issues/5919
- s3:GetEncryptionConfiguration
- s3:PutEncryptionConfiguration
- s3:DeleteBucketPolicy
Resource: '*'
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:DeleteLogGroup
- logs:CreateLogStream
- logs:DeleteLogStream
- logs:PutLogEvents
- logs:DescribeLogGroups
- logs:DescribeLogStreams
- logs:TagResource
Resource: '*'
- Effect: Allow
Action:
- apigateway:GET
- apigateway:POST
- apigateway:PUT
- apigateway:DELETE
Resource: '*'
- Effect: Allow
Action:
- iam:GetRole
- iam:DeleteRolePolicy
- iam:CreateRole
- iam:DeleteRole
- iam:PutRolePolicy
- iam:PassRole
Resource: '*'
- Effect: Allow
Action:
- states:*
Resource: '*'
- Effect: Allow
Action:
- mongodb:*
Resource: '*'
- Effect: Allow
Action:
- events:*
Resource: '*'
- Effect: Allow
Action:
- sqs:*
Resource: '*'
- Effect: Allow
Action:
- dynamodb:*
Resource: '*'
- Effect: Allow
Action:
- cognito-user-pools:*
Resource: '*'
- Effect: Allow
Action:
- cognito-idp:*
Resource: '*'
functions:
# 1시간마다 실행되는 스케줄러
main:
handler: src/handler.main
timeout: 30
events:
- schedule: rate(30 minutes)
# 개발용 엔드포인트
- http:
path: main
method: get
cors: true
divideNoticeEmails:
handler: src/handler.divideNoticeEmails
timeout: 30
events:
- sqs:
arn: ${env:DIVIDE_EMAIL_SQS_ARN}
batchSize: 1
enabled: true
# sqs 로 email 알림을 보내는 함수
sendEmail:
handler: src/handler.sendEmail
timeout: 30
events:
- sqs:
arn: ${env:SEND_EMAIL_SQS_ARN}
batchSize: 5
enabled: true
- http:
path: send-email
method: get
cors: true
plugins:
- serverless-dotenv-plugin
- serverless-plugin-typescript
- serverless-offline
- serverless-tscpaths
custom:
dotenv:
# stage가 dev면 .env.dev, stage가 prod면 .env.prod
path: .env.${self:provider.stage}