An example .NET Core Lambda consuming a DynamoDB Stream. Runs in LocalStack on Docker.
Requires .NET Core 2.1, Docker, Docker Compose, the aws cli (or awslocal) and 7Zip on the path if using Windows.
dotnet publish src/LocalDynamoDbStream
zip -rj function.zip src/LocalDynamoDbStream/bin/Debug/netcoreapp2.1/publish
dotnet publish src/LocalDynamoDbStream
7z a -tzip function.zip ./src/LocalDynamoDbStream/bin/Debug/netcoreapp2.1/publish/*
Start LocalStack and wait for the provisioning to complete.
docker-compose up
aws --endpoint-url=http://localhost:4569 dynamodb put-item \
--table-name local-table \
--item Id={S="key1"},Value={S="value1"}
Note that CloudWatch Logs do not appear to be working from Windows hosts (see here).
aws --endpoint-url=http://localhost:4586 logs filter-log-events \
--log-group-name /aws/lambda/local-function
If you have made changes to the Lambda and want to update the existing version, first use the commands above to re-publish and zip, then replace the function using the following.
aws --endpoint-url=http://localhost:4574 lambda update-function-code \
--function-name local-function \
--zip-file fileb://function.zip