-
Notifications
You must be signed in to change notification settings - Fork 6
/
template.yaml
93 lines (87 loc) · 2.62 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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
Function responsible for reading and processing a CSV file with user attributes from an S3 bucket and posting them to Braze API
Metadata:
AWS::ServerlessRepo::Application:
Name: braze-user-attribute-import
Description: Processes user attribute CSV files and imports them to Braze
Author: Braze
SpdxLicenseId: MIT
LicenseUrl: LICENSE.txt
ReadmeUrl: README_APP_REPO.md
Labels: ["braze", "user-attributes"]
HomePageUrl: https://github.com/braze-inc/growth-shares-lambda-user-csv-import
SemanticVersion: 0.2.5
SourceCodeUrl: https://github.com/braze-inc/growth-shares-lambda-user-csv-import
Parameters:
BrazeAPIKey:
Type: String
Description: Braze API Key necessary to authorize the connection
BrazeAPIURL:
Type: String
Description: Braze API URL necessary to connect to Braze servers
Globals:
Function:
Timeout: 900
Resources:
BrazeUserImportBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Join
- "-"
- - "braze-user-csv-import"
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref "AWS::StackId"
Metadata:
Description: Uploading a CSV file to this bucket will trigger the User Attribute processing Lambda
BrazeUserCSVImport:
Type: AWS::Serverless::Function
Properties:
FunctionName: braze-user-csv-import
CodeUri: braze_user_csv_import/
Handler: app.lambda_handler
Runtime: python3.12
MemorySize: 2048
EventInvokeConfig:
MaximumRetryAttempts: 0
Environment:
Variables:
BRAZE_API_KEY: !Ref BrazeAPIKey
BRAZE_API_URL: !Ref BrazeAPIURL
TYPE_CAST: ""
TOPIC_ARN: ""
Events:
S3Event:
Type: S3
Properties:
Bucket: !Ref BrazeUserImportBucket
Events: s3:ObjectCreated:*
Filter:
S3Key:
Rules:
- Name: suffix
Value: .csv
Policies:
- LambdaInvokePolicy:
FunctionName: braze-user-csv-import
- S3ReadPolicy:
BucketName: !Join
- "-"
- - "braze-user-csv-import"
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref "AWS::StackId"