-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
63 lines (58 loc) · 1.96 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
sns-s3-influxdb
Sample SAM Template for sns-s3-influxdb
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 30
Resources:
# PythonPackages:
# Type: AWS::Serverless::LayerVersion
# Properties:
# ContentUri: python_packages
# CompatibleRuntimes:
# - python3.7
# Metadata:
# BuildMethod: python3.7
WriteToInfluxDBFunction:
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: write_to_influxdb/
Handler: app.lambda_handler
Runtime: python3.7
Policies:
- AmazonS3ReadOnlyAccess
Environment:
Variables:
INFLUXDB_URL: !Ref InfluxDBUrl
INFLUXDB_BUCKET_NAME: !Ref InfluxDBBucketName
INFLUXDB_ORG: !Ref InfluxDBOrg
INFLUXDB_TOKEN: !Ref InfluxDBToken
INFLUXDB_MEASUREMENT_NAME: !Ref InfluxDBMeasurementName
# Layers:
# - !Ref PythonPackages
Events:
NewFetchObject:
Type: SNS # More info about SNS Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#sns
Properties:
Topic: arn:aws:sns:us-east-1:470049585876:NewFetchObject
Parameters:
InfluxDBUrl:
Type: String
InfluxDBBucketName:
Type: String
InfluxDBOrg:
Type: String
InfluxDBToken:
Type: String
InfluxDBMeasurementName:
Type: String
Outputs:
WriteToInfluxDBFunction:
Description: "Write to InfluxDB Function ARN"
Value: !GetAtt WriteToInfluxDBFunction.Arn
WriteToInfluxDBFunctionIamRole:
Description: "Implicit IAM Role created for Write to InfluxDB function"
Value: !GetAtt WriteToInfluxDBFunctionRole.Arn