Invoking the first Lambda function manually via AWS Console or AWS CLI to create an order that will be saved into the DynamoDB table. The second Lambda function will be triggered if there's a new record from the stream that contains the stream records. The second Lambda function will process the received record and update the status
attribute.
- Go to Lambda → Lambda Function → Test tab
- Update the Event JSON textarea field to
{}
- Click on the Test button in the upper right corner
-
Use the following command and replace the placeholder
lambda_function_name
with the actual Lambda function nameaws lambda invoke \ --function-name lambda_function_name \ --payload '{}' \ response.json
- Core components of Amazon DynamoDB
- Using AWS Lambda with Amazon DynamoDB
- Best practices for designing and using partition keys effectively
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template
-
Install all the dependencies, bootstrap your project, and synthesized CloudFormation template.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/lambda/lambda-dynamodb$ make init # With "profile" parameter dev@dev:~:aws-cdk-samples/lambda/lambda-dynamodb$ make init profile=[profile_name]
-
Deploy the project.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/lambda/lambda-dynamodb$ make deploy # With "profile" parameter dev@dev:~:aws-cdk-samples/lambda/lambda-dynamodb$ make deploy profile=[profile_name]