Configure DynamoDB stream locally
See original GitHub issueIssue Description
I’m trying to trigger a lambda to update an Elastic Search instance whenever changes are made to DynamoDB. I have the stream set up in my serverless.yaml
file, and when I deploy it, the lambda is triggered. However, when I run this with serverless-offline
, the function is not triggered.
Here is my serverless.yaml
service: my-service
plugins:
- serverless-dynamodb-local
- serverless-offline
custom:
tableName: "dynamodb-${self:provider.stage}"
dynamodb:
start:
migrate: true
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: ca-central-1
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeStream
- dynamodb:GetRecords
- dynamodb:GetShardIterator
- dynamodb:ListStreams
Resource:
- { "Fn::GetAtt": ["DynamoDbTable", "Arn" ] }
functions:
# Request that should trigger function
add:
handler: handler.add
events:
- http:
path: api/add
method: POST
# Function that should be triggered
updateIndices:
handler: handler.updateIndices
events:
- stream:
type: dynamodb
arn:
Fn::GetAtt:
- DynamoDbTable
- StreamArn
startingPosition: LATEST
batchSize: 1
enabled: true
resources:
Resources:
DynamoDbTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Delete
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
ElasticSearchInstance:
Type: "AWS::Elasticsearch::Domain"
Properties:
EBSOptions:
EBSEnabled: true
VolumeType: gp2
VolumeSize: 10
ElasticsearchClusterConfig:
InstanceType: t2.small.elasticsearch
InstanceCount: 1
DedicatedMasterEnabled: false
ZoneAwarenessEnabled: false
ElasticsearchVersion: "6.0"
Is what I’m trying to do possible with serverless-dynamodb-local
? Or is there more configuration that needs to be added to fire this function locally?
Thanks for the help!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
DynamoDB local usage notes - AWS Documentation
Discover important tips for using and running DynamoDB locally on your computer. ... If you're using DynamoDB Streams, the rate at which shards...
Read more >Stream support for local dynamodb? - Stack Overflow
Start DynamoDB local with java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -sharedDb; Navigate to http://localhost: ...
Read more >A complete guide on DynamoDB with a tutorial on how to set ...
To setup DynamoDB locally, you have to follow certain steps. This might seem complicated at once. But if you carefully follow all the...
Read more >How to run DynamoDB Local and Offline - Complete Guide
Make sure you have Docker installed. · Create a file called docker-compose. · First, make sure you have Java Runtime Environment (JRE) version...
Read more >Configure DynamoDB stream locally · Issue #151 - GitHub
I have the stream set up in my serverless.yaml file, and when I deploy it, the lambda is ... Configure DynamoDB stream locally...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 here. @rehrumesh Were you ever able to find out more?
Hi, I am also facing the same issue. I have tried the below plugins
I am able see the data persisted in dynamodb local but the streams is not triggered. I am using serverless 3.0 framework.