-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
44 lines (38 loc) · 893 Bytes
/
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
service: aws-daily-usage-notifier
frameworkVersion: '3'
plugins:
- serverless-plugin-typescript
provider:
name: aws
runtime: nodejs14.x
region: ap-southeast-1
timeout: 300
environment:
TOPIC_ARN: ${self:custom.SnsArn}
iam:
role:
statements:
- Effect: Allow
Action:
- sns:Publish
- ce:GetCostAndUsage
Resource: '*'
resources:
Resources:
SnsTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: "AWS Daily Cost Usage"
TopicName: "Cost-Notifier-Topic"
Subscription:
- Endpoint: ${self:custom.targetEmail}
Protocol: email
functions:
CostNotifier:
handler: src/handler.costNotifier
events:
- schedule: cron(0 14 * * ? *)
custom:
targetEmail: '[email protected]'
SnsTopic: !GetAtt SnsTopic.TopicName
SnsArn: !Ref SnsTopic