Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 3.02 KB

File metadata and controls

65 lines (50 loc) · 3.02 KB

Lambda → DynamoDB → Lambda

lambda-dynamodb-lambda

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.

Invoking Lambda function via AWS Console

  1. Go to Lambda → Lambda Function → Test tab
  2. Update the Event JSON textarea field to {}
  3. Click on the Test button in the upper right corner

Invoking Lambda function via AWS CLI

  1. Use the following command and replace the placeholder lambda_function_name with the actual Lambda function name

    aws lambda invoke \
    --function-name lambda_function_name \
    --payload '{}' \
    response.json

AWS CDK API / Developer Reference

AWS SDK v2 API / Developer Reference

AWS Documentation Developer Guide

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

Deploy

Using make command

  1. 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]
  2. 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]