-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
91 lines (80 loc) · 2.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
service: mc-serverless-backend
# Create an optimized package for our functions
package:
individually: true
plugins:
- serverless-bundle # Package our functions with Webpack
custom:
# Our stage is based on what is passed in when running serverless
# commands. Or fallsback to what we have set in the provider section.
stage: ${opt:stage, self:provider.stage}
# Set the table name here so we can use it while testing locally
tableName: ${self:custom.stage}-mc
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage}
region: us-east-1
API_KEY: ${opt:API_KEY}
ORX_SECRET_KEY: ${opt:ORX_SECRET_KEY}
ORX_API_KEY: ${opt:ORX_API_KEY}
# These environment variables are made available to our functions
# under process.env.
environment:
tableName: ${self:custom.tableName}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
# Restrict our IAM role permissions to
# the specific table for the stage
Resource:
- "Fn::GetAtt": [McTable, Arn]
functions:
getData:
handler: functions/getData.main
environment:
Stage: ${self:provider.stage}
events:
- http:
path: /getData
method: get
cors: true
private: false
cronDataCMC:
handler: functions/cronDataCMC.main
events:
- schedule: rate(5 minutes)
environment:
API_KEY: ${self:provider.API_KEY}
cronDataBUDA:
handler: functions/cronDataBUDA.main
events:
- schedule: rate(1 minute)
cronDataCMKT:
handler: functions/cronDataCMKT.main
events:
- schedule: rate(1 minute)
cronDataORX:
handler: functions/cronDataORX.main
events:
- schedule: rate(1 minute)
environment:
ORX_API_KEY: ${self:provider.ORX_API_KEY}
ORX_SECRET_KEY: ${self:provider.ORX_SECRET_KEY}
cronDataSTTG:
handler: functions/cronDataSTTG.main
events:
- schedule: rate(1 minute)
# Create our resources with separate CloudFormation templates
resources:
# API Gateway Errors
- ${file(resources/api-gateway-errors.yml)}
# DynamoDB
- ${file(resources/dynamodb-table.yml)}