-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
134 lines (119 loc) · 6.12 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
iot_rekognition_demo
Demo of Greengrass Iot PiCam and Rekognition
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 5
AutoPublishAlias: live # More info about Safe Deployments: https://github.com/awslabs/serverless-application-model/blob/master/docs/safe_lambda_deployments.rst
DeploymentPreference:
# Type: Linear10PercentEvery1Minute
Type: AllAtOnce
Resources:
CamTrigger:
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: cam_trigger/build
Handler: cam_trigger.lambda_handler
Runtime: python3.6
Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
Policies:
- Version: '2012-10-17' # Policy Document
Statement:
- Effect: Allow
Action:
- iot:Publish
- iot:GetThingShadow
Resource: '*'
Events:
Api:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /trigger
Method: GET
IotRule:
Type: IoTRule
Properties:
Sql: "SELECT * FROM 'iotbutton/G030JF055524379N'"
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
IOT_REGION: "eu-central-1"
PictureResults:
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: picture_results/build
Handler: picture_results.lambda_handler
Runtime: python3.6
Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
Policies:
- Version: '2012-10-17' # Policy Document
Statement:
- Effect: Allow
Action:
- iot:Publish
- iot:GetThingShadow
Resource: '*'
Events:
Api:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /results
Method: GET
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
IOT_REGION: "eu-central-1"
THING_NAME: "roeland-greengrass1_Core"
# PictureTaker:
# 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: picture_taker
# Handler: picture_taker.lambda_handler
# Runtime: python2.7
# Timeout: 60
# Tracing: Active
RekognitionSkill:
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: rekognition_skill/build
Handler: rekognition_skill.lambda_handler
Runtime: python3.6
Timeout: 120
Tracing: Active
Events:
Alexa:
Type: AlexaSkill
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
IMG_URL: "https://s3-eu-west-1.amazonaws.com/roeland-greengrass2/image.png"
API_URL: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
# IotButtonTrigger:
# 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: iot_button_trigger/build
# Handler: iot_button_trigger.lambda_handler
# Runtime: python3.6
# Timeout: 120
# Tracing: Active
# Events:
# Type: IoTRule
# Properties:
# Sql: "SELECT * FROM 'iotbutton/G030JF055524379N'"
# # Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
# # Variables:
# # IMG_URL: "https://s3-eu-west-1.amazonaws.com/roeland-greengrass2/image.png"
# # API_URL: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
Outputs:
ApigwURL:
Description: "API Gateway endpoint URL for Prod environment for First Function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
CamTrigger:
Description: "CamTrigger Function ARN"
Value: !GetAtt CamTrigger.Arn
RekognitionSkill:
Description: "rekognition_skill Function ARN"
Value: !GetAtt RekognitionSkill.Arn
PictureResults:
Description: "PictureResults Function ARN"
Value: !GetAtt PictureResults.Arn