AWS Serverless PoC (API Gateway + Lambda + DynamoDB)

We use the classic AWS serverless architecture to demonstrate how to build a simple chat room service.


  1. Install and configure AWS CLI environment: Installation – Installing or updating the latest version of the AWS CLI. Configuration – Configure basic settings that AWS CLI uses to interact with AWS. NOTE: Make sure your IAM User/Role has sufficient permissions.
  2. Install Node Version Manager: Install NVM – Install NVM and configure your environment according to this document.
  3. Install Node.js:
    nvm install 16.3.0
  4. Install AWS CDK Toolkit:
    npm install -g aws-cdk
  5. Install Golang: Download and Install – Download and install Go quickly with the steps described here.
  6. Install Docker: Install Docker Engine – The installation section shows you how to install Docker on a variety of platforms.
  7. Make sure you also have GNU Make, jq installed.


Run the following command to deploy AWS infra and code by CDK Toolkit: deploy

If all goes well, you will see the following output:

CdkGolangExample-ApiGtwLambdaDdb.LambdaRestApiEndpointCCECE4C1 =
Stack ARN:

✨  Total time: 133.05s

You can also clean up the deployment by running command: destroy


As you see in the output of the Deployment step, the URL is your API Gateway endpoint:

We have integrated two Lambda functions with the following resource paths:


You can POST user comment by following API:

Content-Type: application/json
x-api-key: dI65dhFd3742OmUhbdxYo4CT2eOwfoUT1FCtm8ml
  "name"    : string,
  "comment" : string,
  "chatRoom": string
Status Code: 201 Created

Or you can QUERY user comments by following API:

x-api-key: dI65dhFd3742OmUhbdxYo4CT2eOwfoUT1FCtm8ml
Status Code: 200 OK
    "name"   :string,
    "time"   :string


In your day-to-day development work, running Lambda functions locally can improve productivity. All scripting tools related to Lambda functions are in the ‘functions’ directory. Run the following command to build a Docker image and run the container:

Script for running RIE in local.

Usage: <lambda_function_name>
Examples: put-chat-records

Keep running and open another terminal, run the test script:

Script for testing lambda function in local.

Usage: <json body>
Examples: '{"body":"{\"name\":\"Cow\",\"comment\":\"Sample comment!\",\"chatRoom\":\"101\"}"}'

The first two examples are for put-chat-records function, and the last two examples are for get-chat-records function. When you are done modifying the Lambda function code, you can run the following command again: deploy


View Github