-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
71 lines (68 loc) · 1.66 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
service: gas-price-monitor-tool
frameworkVersion: '2'
useDotenv: true
custom:
gasPriceBucketName: gas-price-bucket
subscriptionsTableName: gas-subscriptions
provider:
name: aws
runtime: nodejs14.x
apiGateway:
shouldStartNameWithService: true
lambdaHashingVersion: 20201221
logRetentionInDays: 14
stage: dev
region: us-east-1
apiKeys:
- key
iamRoleStatements:
- Effect: 'Allow'
Action:
- 's3:*'
Resource: '*'
- Effect: 'Allow'
Action:
- 'ses:SendEmail'
Resource: '*'
- Effect: 'Allow'
Action: 'dynamodb:*'
Resource: '*'
environment:
gasPriceBucket: ${self:custom.gasPriceBucketName}
subscriptionsTableName: ${self:custom.subscriptionsTableName}
gasPriceDataFile: ${env:gasPriceDataFile}
gasDataUrl: ${env:gasDataUrl}
emailSender: ${env:emailSender}
functions:
MonitorTool:
handler: src/cron/poller.handler
events:
- schedule: rate(6 hours)
API:
handler: src/api.handler
events:
- http:
path: /{any+}
method: ANY
private: true
cors: true
resources:
Resources:
PriceBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.gasPriceBucketName}
AccessControl: Private
SubscriptionsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.subscriptionsTableName}
AttributeDefinitions:
- AttributeName: email
AttributeType: S
KeySchema:
- AttributeName: email
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1