I’ve looked around for some examples of connecting to DynamoDb inside my simple Lambda function but had some difficulty putting it together.
When I followed some samples here I was consistently getting told my hello
lambda function resource wasnt found.
So I pulled down the most recent master (9/17/2016) and, thanks to running serverless deploy --noDeploy
, I figured out the name of the lambda name the resource config expects, resulting in:
service: my-api
provider:
name: aws
runtime: nodejs4.3
iamRoleStatements:
- Effect: "Allow"
Resource: "*"
Action:
- "dynamodb:*"
functions:
hello:
handler: handler.hello
events:
- http:
path: users
method: GET
resources:
Resources:
mapping:
Type: AWS::Lambda::EventSourceMapping
Properties:
BatchSize: 100
EventSourceArn: <dynamodb-stream-arn>
FunctionName:
Fn::GetAtt:
- "HelloLambdaFunction"
- "Arn"
StartingPosition: "TRIM_HORIZON"
This actually worked and I could talk to my DDB inside my lambda when invoked but does one typically reference the name of the Lambda function this way : {FunctionNameAsPascal}LambdaFunction ?