-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemplate.yaml
67 lines (58 loc) · 1.43 KB
/
template.yaml
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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
aws-billing-messaging
Send AWS monthy summary billing every day in a slack channel or telegram.
Globals:
Function:
Timeout: 3
MemorySize: 128
Parameters:
SlackWebhookToken:
Type: String
Default: ""
TelegramChatId:
Type: String
Default: ""
TelegramToken:
Type: String
Default: ""
ServiceQuantity:
Type: Number
Default: 5
LowCost:
Type: Number
Default: 10
HighCost:
Type: Number
Default: 50
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: aws_billing_messaging/
Handler: app.lambda_handler
Runtime: python3.9
Architectures:
- x86_64
Environment:
Variables:
SLACK_WEBHOOK_TOKEN: !Ref SlackWebhookToken
TELEGRAM_CHAT_ID: !Ref TelegramChatId
TELEGRAM_TOKEN: !Ref TelegramToken
SERVICE_QUANTITY: !Ref ServiceQuantity
LOW_COST: !Ref LowCost
HIGH_COST: !Ref HighCost
Events:
MyFunctionSchedule:
Type: Schedule
Properties:
# Every day at 11:00 UTC / 08am BRT
Schedule: cron(0 11 * * ? *)
Policies:
- Statement:
- Sid: CostExplorerLambdaPermission
Effect: Allow
Action:
- ce:GetCostAndUsage
Resource: "*"