-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.yaml
97 lines (92 loc) · 2.92 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
This application syncs BUNQ transactions to YNAB. After deployment you FIRST need
to add your BUNQ api_token and YNAB accesstoken. To the SSM parameter. Next you
need to run the function to list your accounts and budgets. Add these to your SSM
parameter as well. Finally set the LIST_MODE environment variable to 0.
Metadata:
AWS::ServerlessRepo::Application:
Name: bunq-ynab-aws-lambda
Description: >
This application syncs BUNQ transactions to YNAB. You need to run the function
to list your accounts and budgets. Next add these to your SSM parameter json.
Finally set the LIST_MODE environment variable to 0. Full instructions in the
README file.
Author: Javy de Koning
ReadmeUrl: README.md
SpdxLicenseId: Apache-2.0
LicenseUrl: LICENSE
Labels: ['Bunq', 'Ynab']
HomePageUrl: https://github.com/javydekoning/bunq-ynab-aws-lambda
SemanticVersion: 0.1.0
SourceCodeUrl: https://github.com/javydekoning/bunq-ynab-aws-lambda
Parameters:
BunqApiToken:
Type: String
Description: Your BUNQ API Token
YnabAccessToken:
Type: String
Description: Your YNAB access token
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 30
Resources:
bunq2ynab:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: bunq2ynab/
Handler: app.lambda_handler
Runtime: python3.8
Environment:
Variables:
SSM_PARAM:
Ref: ConfigJSON
LOG_LEVEL: 'INFO'
LIST_MODE: '1'
Policies:
- Statement:
- Sid: SSMGetPutPolicy
Effect: Allow
Action:
- ssm:GetParameter
- ssm:PutParameter
Resource: !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${ConfigJSON}'
Events:
CloudWatchCronEvent:
Type: Schedule
Properties:
Schedule: rate(5 minutes)
ConfigJSON:
Type: AWS::SSM::Parameter
Properties:
Name: bunq2ynab
Type: String
Value: !Sub >
{
"bunq": {
"api_token": "${BunqApiToken}",
"priv_key": "",
"install_token": "",
"session_token": ""
},
"bunq2ynab": [{
"bunq_user": "",
"bunq_acc": "",
"ynab_budget": "",
"ynab_acc": ""
},
{
"bunq_user": "",
"bunq_acc": "",
"ynab_budget": "",
"ynab_acc": ""
}
],
"ynab": {
"accesstoken": "${YnabAccessToken}",
"clientid": "",
"clientsecret": ""
}
}