-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
63 lines (57 loc) · 1.59 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
# It's important that the version of serverless is larger than 1.4 as this is the version that
# introduced correctly the `async: true` invocationType for API Gateway events.
frameworkVersion: '>=1.4.0'
service: in-stock-checker
plugins:
- serverless-webpack
- serverless-prune-plugin
- serverless-offline
custom:
stage: ${opt:stage, self:provider.stage}
secrets:
# Secrets from SSM are loaded here
webpack: # used for serverless framework to bundle and send to aws
webpackConfig: ./webpack.config.js
includeModules:
forceExclude:
- aws-sdk
pruneCount:
dev: 2
production: 3
prune:
automatic: true
number: ${self:custom.pruneCount.${self:custom.stage}}
provider:
name: aws
runtime: nodejs12.x
region: us-east-1
timeout: 50
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'SNS:Publish'
Resource:
- !Ref PlantInStockTopic
environment:
PLANT_URL: 'https://www.logees.com/variegated-mexican-breadfruit-monstera-deliciosa-variegata.html'
PLANT_IN_STOCK_TOPIC: !Ref PlantInStockTopic
functions:
checkPlantInStock:
handler: functions/check-plant-in-stock.handler
events:
- schedule:
rate: rate(1 minute)
resources:
Resources:
PlantInStockTopic:
Type: 'AWS::SNS::Topic'
Properties:
DisplayName: Plant is in stock!
TopicName: plantInStock-${self:custom.stage}
Outputs:
PlantInStockTopicArn:
Description: The ARN for the PlantInStockTopic
Value:
Ref: PlantInStockTopic
Export:
Name: event:${self:custom.stage}:plantInStock