Skip to content

Instantly share code, notes, and snippets.

@rts-rob
Last active September 11, 2017 12:49
Show Gist options
  • Save rts-rob/9e5a01bd05ff6478061c4c00743a6e44 to your computer and use it in GitHub Desktop.
Save rts-rob/9e5a01bd05ff6478061c4c00743a6e44 to your computer and use it in GitHub Desktop.
Simple SAM example with one DynamoDB table and one Lambda function
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
someTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: version
AttributeType: 'N'
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: version
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
someFunction:
Type: 'AWS::Serverless::Function'
Properties:
Handler: someFunction.handler
Runtime: nodejs6.10
CodeUri: .
Policies: []
Events:
Tablet1:
Type: DynamoDB
Properties:
Stream: !GetAtt someTable.StreamArn
StartingPosition: TRIM_HORIZON
BatchSize: 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment