Skip to content

Instantly share code, notes, and snippets.

@johncmckim
Last active November 24, 2017 04:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johncmckim/91b77ef3e421de337dd823045e91982c to your computer and use it in GitHub Desktop.
Save johncmckim/91b77ef3e421de337dd823045e91982c to your computer and use it in GitHub Desktop.
Garden Aid - IoT Hub - serverless.yml
service: garden-aid-iot-hub
provider:
name: aws
runtime: nodejs4.3
# custom variable syntax is needed to avoid conflits with aws cloudformation functions
variableSyntax: '\${{([\s\S]+?)}}'
# load custom variables from a file
custom: ${{file(./vars-${{opt:stage}}.yml)}}
# define the check moisture level function
functions:
checkMoistureLevel:
handler: index.checkMoistureLevel
resources:
Resources:
# DynamoDB - see https://gist.github.com/johncmckim/9bec3ee3ed07722eb1bd4335bcd80910
# IoT - see https://gist.github.com/johncmckim/5d149fb2416f38957c2d0e30f56c6aba
LambdaInvokePermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: { Fn::GetAtt: [ checkMoistureLevel, Arn ] }
Action: lambda:InvokeFunction
Principal: iot.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment