forked from iandees/aws-billing-to-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
42 lines (35 loc) · 1.08 KB
/
Copy pathserverless.yml
File metadata and controls
42 lines (35 loc) · 1.08 KB
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
service: aws-billing-to-slack
plugins:
- serverless-python-requirements
provider:
name: aws
# Sane defaults, easy for multi-account/multi-region organizations
profile: ${opt:aws_profile, env:AWS_PROFILE, 'default'}
region: ${opt:aws_region, env:AWS_REGION, env:AWS_DEFAULT_REGION, 'us-east-1'}
runtime: python3.7
iamRoleStatements:
- Effect: "Allow"
Action:
- "ce:GetCostAndUsage"
Resource: "*"
# Needed to get account alias
- Effect: "Allow"
Action:
- "iam:ListAccountAliases"
Resource: "*"
functions:
report_cost:
handler: handler.report_cost
description: Send account daily billing data to Slack channel
# Keep costs minimal
memorySize: 128
timeout: 10
events:
# Every day at 15:00 UTC / 10am CDT
- schedule: cron(0 15 * * ? *)
environment:
SLACK_WEBHOOK_URL: ${opt:slack_url}
AWS_ACCOUNT_NAME: ${opt:aws_account}
CREDITS_EXPIRE_DATE: ${opt:credits_expire_date}
CREDITS_REMAINING_AS_OF: ${opt:credits_remaining_date}
CREDITS_REMAINING: ${opt:credits_remaining}